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.

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:
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.>
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
Most helpful comment
Thanks again for reporting this @nakatsuchi this should be fixed when we release
7.0.0