0

Using SpringBoot data elasticsearch

Need to print the Elasticsearch JSON representation of the query

Creating a org.springframework.data.elasticsearch.core.query.CriteriaQuery that is passed to org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate::search()

Can print the criteriaQuery.getCriteria().getCriteriaChain() and get some good information but need to get the JSON query that is created (I believe) by the REST client

Looking at various page e.g., it seems to be a tricky affair https://github.com/spring-projects/spring-data-elasticsearch/issues/1808

Tried log level like: logging.level.org.springframework.data.elasticsearch.core=TRACE

But also no joy

What is the simplest/easiest way to get the JSON ?

Any help is much appreciated

1 Answer 1

0

Managed to print JSON by adding

logging.level.tracer=TRACE

logging.file.name=logs/es.log

to

application.properties

It print a lot but includes the JSON query

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.