Search code examples
elasticsearchelasticsearch-java-api

Log request/response from ElasticSearch Transport client with SpringBoot application


I'm using ElasticSearch's Transport Client in my SpringBoot application. Logback is used as my logging implementation.

Is there a way to enable logging of request/response from ElasticSearch Transport client to help in troubleshooting?


Solution

  • For logging the request to Elastic Search doing a toString on SearchRequestBuilder should give you the actual JSON request. For logging the response doing a toString on SearchResponse should give you the actual JSON response.