# Logging of queries for debugging

**URL:** <https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013>\
**Category:** Elasticsearch\
**Created:** [July 31, 2013, 1:08pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013 "2013-07-31T13:08:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [July 31, 2013, 1:08pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/1 "2013-07-31T13:08:03Z")

</div>

Hi,

is it possible to log incomming queries? I have a query which results  
differ if I execute it via cURL or jQuery.

For debugging it would be great to have the possibility to log incoming  
queries.

Best,

Oliver

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 31, 2013, 1:19pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/2 "2013-07-31T13:19:46Z")

</div>

You can log slow queries.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

So may be setting to something like: `index.search.slowlog.threshold.query.trace: 5ms` could help?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 31 juil. 2013 à 15:08, "Oliver B. Fischer" [mailsink@swe-blog.net](mailto:mailsink@swe-blog.net) a écrit :

> Hi,
> 
> is it possible to log incomming queries? I have a query which results differ if I execute it via cURL or jQuery.
> 
> For debugging it would be great to have the possibility to log incoming queries.
> 
> Best,
> 
> Oliver
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [August 2, 2013, 11:07pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/3 "2013-08-02T23:07:13Z")

</div>

Hi David,

I set all settings to 1ms but ES logs only that a slow search happened  
but not the query itself. And I need the query.

It is very disappointing that ES does not support such basic  
development/operations/debugging feature.

Best,

Oliver

Am 31.07.13 15:19, schrieb David Pilato:

> You can log slow queries.  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/slowlog/)
> 
> So may be setting to something like:  
> `index.search.slowlog.threshold.query.trace: 5ms` could help?
> 
> --  
> _David Pilato_ | /Technical Advocate/ | _[Elasticsearch.com](http://Elasticsearch.com)  
> [http://Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) |@scrutmydocs  
> [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 31 juil. 2013 à 15:08, "Oliver B. Fischer" \<[mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)  
> [mailto:mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)\> a écrit :
> 
> > Hi,
> > 
> > is it possible to log incomming queries? I have a query which results  
> > differ if I execute it via cURL or jQuery.
> > 
> > For debugging it would be great to have the possibility to log  
> > incoming queries.
> > 
> > Best,
> > 
> > Oliver
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 3, 2013, 5:22am UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/4 "2013-08-03T05:22:00Z")

</div>

May be changing log level in logging.yml will show you some elements.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 3 août 2013 à 01:07, "Oliver B. Fischer" [mailsink@swe-blog.net](mailto:mailsink@swe-blog.net) a écrit :

Hi David,

I set all settings to 1ms but ES logs only that a slow search happened but not the query itself. And I need the query.

It is very disappointing that ES does not support such basic development/operations/debugging feature.

Best,

Oliver

Am 31.07.13 15:19, schrieb David Pilato:

> You can log slow queries.  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/slowlog/)
> 
> So may be setting to something like:  
> `index.search.slowlog.threshold.query.trace: 5ms` could help?
> 
> --  
> _David Pilato_ | /Technical Advocate/ | _[Elasticsearch.com](http://Elasticsearch.com)  
> [http://Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) |@scrutmydocs  
> [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 31 juil. 2013 à 15:08, "Oliver B. Fischer" \<[mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)  
> [mailto:mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)\> a écrit :
> 
> > Hi,
> > 
> > is it possible to log incomming queries? I have a query which results  
> > differ if I execute it via cURL or jQuery.
> > 
> > For debugging it would be great to have the possibility to log  
> > incoming queries.
> > 
> > Best,
> > 
> > Oliver
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 3, 2013, 4:45pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/5 "2013-08-03T16:45:51Z")

</div>

A few months ago, I offered a patch so that lowering the log level in  
logging.yml can be used to show the queries.

> <https://github.com/elastic/elasticsearch/pull/3041>
>
> Hi Elasticsearch team,
> some users want simple query logging, so I added some deb…ug statements. By adding a line "search: DEBUG" in logging.yml, the node requested should output some information about query execution and the JSON source.

Best,

Jörg

On Sat, Aug 3, 2013 at 7:22 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> May be changing log level in logging.yml will show you some elements.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 3 août 2013 à 01:07, "Oliver B. Fischer" [mailsink@swe-blog.net](mailto:mailsink@swe-blog.net) a  
> écrit :
> 
> Hi David,
> 
> I set all settings to 1ms but ES logs only that a slow search happened but  
> not the query itself. And I need the query.
> 
> It is very disappointing that ES does not support such basic  
> development/operations/debugging feature.
> 
> Best,
> 
> Oliver
> 
> Am 31.07.13 15:19, schrieb David Pilato:
> 
> > You can log slow queries.  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/slowlog/)
> > 
> > So may be setting to something like:  
> > `index.search.slowlog.threshold.query.trace: 5ms` could help?
> > 
> > --  
> > _David Pilato_ | /Technical Advocate/ | _[Elasticsearch.com](http://Elasticsearch.com)  
> > [http://Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) |@scrutmydocs  
> > [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > 
> > Le 31 juil. 2013 à 15:08, "Oliver B. Fischer" \<[mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)  
> > [mailto:mailsink@swe-blog.net](mailto:mailsink@swe-blog.net)\> a écrit :
> > 
> > > Hi,
> > > 
> > > is it possible to log incomming queries? I have a query which results  
> > > differ if I execute it via cURL or jQuery.
> > > 
> > > For debugging it would be great to have the possibility to log  
> > > incoming queries.
> > > 
> > > Best,
> > > 
> > > Oliver
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > > [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [August 3, 2013, 8:50pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/6 "2013-08-03T20:50:12Z")

</div>

Would be great to see this patch included in ES. I consider this patch  
as very helpful for the community.

@David: It would be great if you could review this patch and apply it to  
ES.

BYe,

Oliver

Am 03.08.13 18:45, schrieb [joergprante@gmail.com](mailto:joergprante@gmail.com):

> A few months ago, I offered a patch so that lowering the log level in  
> logging.yml can be used to show the queries.
> 
> [Simple query logging for debugging by jprante · Pull Request #3041 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/3041)
> 
> Best,
> 
> Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [August 3, 2013, 8:59pm UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/7 "2013-08-03T20:59:16Z")

</div>

I was able to capture the query send by jQuery with an capturing session  
with Wireshark. Now I know why the jQuery result is different from the  
cURL result.

This is of course a workaround...

Am 03.08.13 07:22, schrieb David Pilato:

> May be changing log level in logging.yml will show you some elements.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 3 août 2013 à 01:07, "Oliver B. Fischer" [mailsink@swe-blog.net](mailto:mailsink@swe-blog.net) a écrit :
> 
> Hi David,
> 
> I set all settings to 1ms but ES logs only that a slow search happened but not the query itself. And I need the query.
> 
> It is very disappointing that ES does not support such basic development/operations/debugging feature.
> 
> Best,
> 
> Oliver

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![santoshraju](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@santoshraju](https://discuss.elastic.co/u/santoshraju)\
**Post date:** [January 6, 2015, 6:09am UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/8 "2015-01-06T06:09:35Z")

</div>

Hi Oliver,

I got the same issue of getting different results for a elasticsearch query using python requests and a normal curl request.

Is it because of any internal cache issues within elasticsearch? Can you help me solve this.

Thank you,  
Santosh

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:40am UTC](https://discuss.elastic.co/t/logging-of-queries-for-debugging/13013/9 "2017-07-06T00:40:37Z")

</div>


