Elasticsearch-net: Reindex returns IsValid=True when invalid response body

Created on 4 Feb 2019  路  2Comments  路  Source: elastic/elasticsearch-net

NEST/Elasticsearch.Net version:
NEST 6.4.2

Elasticsearch version:
Elasticsearch 6.1.2

Description of the problem including expected versus actual behavior:
We are performing ReIndexOnServerAsync to an ES cluster behind a reverse proxy server (Apache).
When the reverse proxy server returns a its own error response with error HTTP status code (eg. 502) and invalid response body (eg. 'text/html'), the value of IsValid property of the response object is true. The value of Success property of the low-level API call response was also true.

In such situation, we expect IsValid to be false because the operation was clearly failed.

image

Proposal
Even if performing multi operation (reindex, update by query, delete by query, ...), IsValid should always be false when the response body is not a valid Elasticsearch JSON response.

Steps to reproduce:

  1. A reverse proxy server (in front of an ES server) returns error status code and error response body.
  2. Perform some multi operation such as reindex, update by query, delete by query.
  3. The reverse proxy server returns some its own error response.
  4. IsValid property of the response object will be true.

DebugInformation:

Valid NEST response built from a successful low level call on POST: /elasticsearch/_reindex?refresh=true&wait_for_completion=true
# Audit trail of this API call:
 - [1] HealthyResponse: Node: https://<IP>/elasticsearch/ Took: 00:07:35.6265539
# Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Discuss backport 6.x v7.0.0

Most helpful comment

Thanks again for reporting this @nakatsuchi this should be fixed when we release 7.0.0

All 2 comments

Thanks for opening @nakatsuchi. We'll look to discuss internally this week.

Thanks again for reporting this @nakatsuchi this should be fixed when we release 7.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmarz picture gmarz  路  5Comments

alwag85 picture alwag85  路  5Comments

codebrain picture codebrain  路  3Comments

fredeil picture fredeil  路  4Comments

mausch picture mausch  路  4Comments