Log Search Queries


(Kenneth Loafman) #1

Hi,

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

...Thanks,
...Ken


(Clinton Gormley) #2

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.

http://search.cpan.org/~drtech/ElasticSearch-0.20/lib/ElasticSearch.pm#trace_calls()

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

clint


(Lukáš Vlček) #3

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.

http://search.cpan.org/~drtech/ElasticSearch-0.20/lib/ElasticSearch.pm#trace_calls()

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

clint


(Shay Banon) #4

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.

http://search.cpan.org/~drtech/ElasticSearch-0.20/lib/ElasticSearch.pm#trace_calls()

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

clint


(melix) #5

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.


(system) #6