# Debugging Query via logging / execution plan

**URL:** <https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487>\
**Category:** Elasticsearch\
**Created:** [July 27, 2016, 9:09am UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487 "2016-07-27T09:09:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asaf\_Mesika](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asaf_mesika/32/10863_2.png) [@Asaf\_Mesika](https://discuss.elastic.co/u/Asaf_Mesika)\
**Post date:** [July 27, 2016, 9:09am UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487/1 "2016-07-27T09:09:49Z")

</div>

Hi,

I was wondering whether Elasticsearch has a feature which enables debug logging per specific query, such you can tell what the node is doing only for a specific query.

Also on that topic - is there a way to know the query execution plan? Something like:

- Splitting this query into those nodes, with this partial query - this took y seconds.
- Per each query on node: the exact graph of operations:  
\*\* Fielddata cache used? No because ..., or Yes.  
\*\* Docvalue used? Yes, timing...?  
...

Thanks,

Asaf

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 28, 2016, 1:41pm UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487/2 "2016-07-28T13:41:49Z")

</div>

We added the query profiler in version 2.2.0. See [https://github.com/elastic/elasticsearch/pull/14889](https://github.com/elastic/elasticsearch/pull/14889) .

It prints out lot of information about the different phases of a search request.

Cheers  
Luca

---

<div class="post-metadata">

**Author:** ![Asaf\_Mesika](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asaf_mesika/32/10863_2.png) [@Asaf\_Mesika](https://discuss.elastic.co/u/Asaf_Mesika)\
**Post date:** [July 31, 2016, 5:54am UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487/3 "2016-07-31T05:54:59Z")

</div>

This is a fantastic API in did.  
Still there are many decision taken by the coordinator node or the data  
node which doesn't get logged. I wrote some examples above. Here's one:

- Was field filter cache used? Why not?
- Was the shard query cache used? why not?  
...  
Think of it as a tracing bullet through the query execution

---

<div class="post-metadata">

**Author:** ![Asaf\_Mesika](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asaf_mesika/32/10863_2.png) [@Asaf\_Mesika](https://discuss.elastic.co/u/Asaf_Mesika)\
**Post date:** [August 7, 2016, 5:14am UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487/4 "2016-08-07T05:14:34Z")

</div>

I've moved the discussion into an issue since I think it's a valid feature request:

> <https://github.com/elastic/elasticsearch/issues/19805>

---

<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 5, 2017, 10:29pm UTC](https://discuss.elastic.co/t/debugging-query-via-logging-execution-plan/56487/5 "2017-07-05T22:29:36Z")

</div>


