Debugging elasticsearch Java API queries as JSON REST queries

Angel Ruiz elasticsearch, java, json, debug


elasticsearch-java-json

It took me enough time to find out, that I think I should make a post for anyone else who is after the answer in the future.

In Groovy code:

log.debug("ElasticSearch Query using Java Client API:\n${searchRequestBuilder.internalBuilder()}")  

And this in Java:

log.debug("ElasticSearch Query using Java Client API:\n" + searchRequestBuilder.internalBuilder());  

The out put is prettified by default.

Share this post: