More extensive Elasticsearch request/response logging

Description

It would be interesting and would help a lot in development, if we could see the output Json sent to elasticsearch, similar to what we have in hibernate for SQL.

Maybe some property to enable it like this:

Thank you.

Environment

None

Activity

Show:
Yoann Rodière
August 28, 2017, 8:43 AM

Hello ,

We already provide this feature through the org.hibernate.search.fulltext_query logger. Set its level to DEBUG or more verbose, and all search queries will be logged.
If you want to log every request sent to the Elasticsearch cluster (including PUT/DELETE etc.), you can use the org.hibernate.search.elasticsearch.request logger (set its level to TRACE or more verbose).
See here: https://docs.jboss.org/hibernate/search/5.8/reference/en-US/html_single/#elasticsearch-logging

The org.hibernate.search.elasticsearch.request logger does not print the JSON content of requests though, mainly because it would be very, very verbose (you can have hundreds of documents in one request). I suppose we could add options to control that, or maybe show only path + query parameters at the DEBUG level, and the whole request at the TRACE level.

And of course, there's the problem of formatting. We could add a configuration option for that, controlling formatting for both the org.hibernate.search.fulltext_query and org.hibernate.search.elasticsearch.request loggers.

Any remarks about the above, before we start working on it?

Leandro Kersting de Freitas
August 28, 2017, 1:16 PM

Hello ,

I think it's a good idea.

My suggestion would be more for loggers in the requests, of course the response is important.
We could also have a configuration option for response.

It would help a lot in development, and of course the developer needs to be aware that the logs might be giants, but it could benefit us in tracking down possible errors and behaviors.

I could do a PR, but I'm not updated to the code of this project. Maybe you can designate another person.

Assignee

Yoann Rodière

Reporter

Leandro Kersting de Freitas

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure