0

I am using the Java client to query the Elasticsearch cluster. On querying, I get the result as a SearchResponse. From it, I get the aggregations as Aggregations agg = sr.getAggregations();. How do I print out the full result as JSON like the result which is got from cURL?

1 Answer 1

1

You just need to print the SearchResponse object, for example:

SearchResponse response = search.execute().actionGet();
log.debug("Response: {}", response);

you can do the same with SearchRequestBuilder:

SearchRequestBuilder search = client.prepareSearch(INDEX)...
log.debug("Search: {}", search);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.