Elasticsearch version: 5.0.0-rc1
Elasticsearch returns a response body when pretty=true is specified on a HEAD request which violates the HTTP 1.1 specification
HEAD http://127.0.0.1:9200/?pretty=true
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 1
This causes a problem within the .NET client, which conforms strictly to the HTTP 1.1 spec.
Additionally, the header is wrong. From RFC 2616:
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
We have a short-term fix for REST main action that will address this issue so that there is not a body. We have a plan to address all HEAD methods as a future follow up (so that the content-length header is correct). There will be a PR from @nik9000 shortly.
I've opened the short term workaround (https://github.com/elastic/elasticsearch/pull/21077) and we'll repurpose this issue for the long term, fully rfc compliant fix.
We'll open a new issue for the content-length piece and relate it here.
Closed by #21077
We'll open a new issue for the content-length piece and relate it here.
Partially addressed in #21123.
Most helpful comment
I've opened the short term workaround (https://github.com/elastic/elasticsearch/pull/21077) and we'll repurpose this issue for the long term, fully rfc compliant fix.