# Logging Search Queries Made on ElasticSearch

**URL:** https://discuss.elastic.co/t/logging-search-queries-made-on-elasticsearch/245950
**Category:** Elasticsearch
**Created:** [August 21, 2020, 6:36pm UTC](https://discuss.elastic.co/t/logging-search-queries-made-on-elasticsearch/245950 "2020-08-21T18:36:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Francois\_Valiquette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francois_valiquette/32/74319_2.png) [@Francois\_Valiquette](https://discuss.elastic.co/u/Francois_Valiquette)
#### Post date: [August 21, 2020, 6:36pm UTC](https://discuss.elastic.co/t/logging-search-queries-made-on-elasticsearch/245950/1 "2020-08-21T18:36:14Z")

</div>

I would like to know if there is a way to log all the search queries made against our Elasticsearch cluster. I assume it might be possible by changing the log level of one of the logging hierarchies as described [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html) but I don't know where I can find a description of all the hierarchies.

I am asking this because we want to do ingestion optimization by changing the field types to minimize the use of processors. To be able to do that, I need to review how fields are being used.

Thank you

---

<div class="post-metadata">

### Author: ![Francois\_Valiquette](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francois_valiquette/32/74319_2.png) [@Francois\_Valiquette](https://discuss.elastic.co/u/Francois_Valiquette)
#### Post date: [August 24, 2020, 9:37pm UTC](https://discuss.elastic.co/t/logging-search-queries-made-on-elasticsearch/245950/2 "2020-08-24T21:37:05Z")

</div>

It seems that logging hierarchies are not documented.

I found the hierarchies I needed by setting globally the log level to critical in elasticsearch.yml:  
`logger.level: CRITICAL`.  
Then by looking at the logs, I found the lines I needed (for example: o.e.s.q.QueryPhase).  
Then on GitLab I found QueryPhase.java and by looking at the folder hierarchy I found out what means o.e.s.f.

tl;dr:  
`logger.org.elasticsearch.tasks.TaskManager: trace logger.org.elasticsearch.search.query.QueryPhase: trace logger.org.elasticsearch.search.fetch.FetchPhase: trace`

---

<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: [September 21, 2020, 9:37pm UTC](https://discuss.elastic.co/t/logging-search-queries-made-on-elasticsearch/245950/3 "2020-09-21T21:37:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
