How to get a full explanation of Elasticsearch Java query?

I am trying very hard to test some of the new evaluation features in my Elasticsearch query, but I am not inferior to the expected results.

I found this on my site about explaining the requests here

I can work as a curl command, but does anyone know how to do this to use the Java api?

+4
source share
1 answer

If you use the ES5 Java API, you can get an explanation as follows:

QueryBuilder query = matchAllQuery(); // your query

ExplainRequest request = new ExplainRequest("index", "type", "id").query(query);
ExplainResponse explainResponse = client.explain(request).actionGet();
Explanation explanation = explainResponse.getExplanation();

Where clientis your instance org.elasticsearch.client.Client.

+3
source

Source: https://habr.com/ru/post/1667909/


All Articles