Elasticsearch: HEAD requests return a response body when pretty=true

Created on 21 Oct 2016  路  6Comments  路  Source: elastic/elasticsearch

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.

:CorInfrREST API >bug blocker v5.0.0

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.

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

abrahamduran picture abrahamduran  路  3Comments

rpalsaxena picture rpalsaxena  路  3Comments

malpani picture malpani  路  3Comments

matthughes picture matthughes  路  3Comments