Explain API and GET

We already know that ES HTTP/JSON API is NOT a REST, but nobody cares (marketing wins). I wrote about this few times.

But why a GET with body is used for querying explain API? It is against rfc2616, where body for GET has no semantics, i.e. body for GET method has no meaning and should be ignored.

I think that these two things are mixed together. ES has no REST API, but HTTP/JSON CRUD-like one. And I think that GET with body is a natural consequence by following CRUD-like pattern. It is ok, but please do it following http rules, too. And please don't call your's API RESTful.

Thanks,
Marcin

This is not specific to the explain API. The search API uses GET too.
I guess your complaint is that the nested query DSL should be encoded into flat GET url parameters?

Part of the reason I wound up gravitating to elasticsearch is queries can get large/complex and I didn't like using another popular search engine which packed all of the search criteria into convoluted URLs.

I think what he is referring to is that the body of GET requests is supposed to be empty. In other words, POST should be used to send the Query DSL to Elasticsearch.

I'm using POST for search.

Not exactly. POST-ing body into explain API would be enough.
Client I'm using cannot send body with GET and I'm getting 400 Bad Request.

Yes.

You can.

1 Like

Thank you. The doc says nothing about POST-ing:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html

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