Log Search Queries

Hi,

Is it possible to log search queries? I'm not familiar with Java logging.

...Thanks,
...Ken

On Tue, 2010-09-14 at 10:54 -0500, Kenneth Loafman wrote:

Hi,

Is it possible to log search queries? I'm not familiar with Java logging.

It certainly is with the Perl client.

but that is implemented in the client, and not in Elasticsearch

clint

As far as I know there is no combination of logging level and package name
for the native ES Java client that would log user queries. This is
intentional. There are two good reasons for this:

  1. one single user query can yield several internal queries within ES
  2. extensive logging can result into performance degradation
    A good way how to go about this is to log user queries on your side right
    before they are handed over to ES Java client.

Regards,
Lukas

On Tue, Sep 14, 2010 at 6:18 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

On Tue, 2010-09-14 at 10:54 -0500, Kenneth Loafman wrote:

Hi,

Is it possible to log search queries? I'm not familiar with Java
logging.

It certainly is with the Perl client.

ElasticSearch - An API for communicating with ElasticSearch - metacpan.org

but that is implemented in the client, and not in Elasticsearch

clint

1 Like

Yea, thats the idea. May I ask why you want to log queries?

On Tue, Sep 14, 2010 at 9:02 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

As far as I know there is no combination of logging level and package name
for the native ES Java client that would log user queries. This is
intentional. There are two good reasons for this:

  1. one single user query can yield several internal queries within ES
  2. extensive logging can result into performance degradation
    A good way how to go about this is to log user queries on your side right
    before they are handed over to ES Java client.

Regards,
Lukas

On Tue, Sep 14, 2010 at 6:18 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

On Tue, 2010-09-14 at 10:54 -0500, Kenneth Loafman wrote:

Hi,

Is it possible to log search queries? I'm not familiar with Java
logging.

It certainly is with the Perl client.

ElasticSearch - An API for communicating with ElasticSearch - metacpan.org

but that is implemented in the client, and not in Elasticsearch

clint

I have a similar need, for debugging purposes only : I use a query generator which builds rather complex queries and it would help debugging if I could see the "JSON form" of the generated query somewhere in the logs.

Right now I'm using a breakpoint in SearchRequestBuilder#doExecute. It works, but it is still difficult to use : copy the "toString" version of the builder, then paste and reformat in IDE.