ElasticSearch Java TransportClient Logging Requests (logback)?


(Christian Schmitt) #1

Hello, is there a way to log all the Requests of Elasticsearch?
I mean if I have a simple Query:
v.prepareSearch()
.setTypes("customer")
.setQuery(QueryBuilders.termQuery("name", name))

Is there a way to get the Json output of that?
We are using logback so if there is a way to have a info logger, it would be great. Else it would be ok to get the Json with code, however if there is a built in way it would be great.


(Douglas Smith) #2

Here is how I do it:

SearchRequestBuilder searchRequest = esClientService.getTransportClient().prepareSearch(indexName)
... more code ...
log.debug searchRequest.inspect()

This returns the JSON query, generated by the Java API


(system) #3