[Resolved] 400 Error ResponseException when using example request code for Java REST Client

Hi,

Im trying to invoke search queries via GET body request.
While trying to execute the example request code here - https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_example_requests.html
Im seeing

org.elasticsearch.client.ResponseException: GET https://myhost.com/es/_search: HTTP/1.1 400 Error

While an invalid query, for example trying to sort by a non existent field, that gives a similar ResponseException 400 error, shows up on elasticsearch logs, the above isnt showing up in logs at all.
Hence proving difficult to debug too.

Any help would be greatly appreciated.

Apparently the gateway did not like GET with body requests and was not letting requests through.
No wonder I wasnt seeing any error msgs from elasticsearch.
I tried GET with body by directly connecting to the machine, worked like charm.
Looks like I will resort to POST with body. This post confirmed the same too - https://github.com/elastic/elasticsearch-py/issues/281
This should be mentioned on the Java REST sample page as a footnote or something. Would have saved me a lot of heart burn.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.