# How to log strings searched in elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-log-strings-searched-in-elasticsearch/60593
**Category:** Elasticsearch
**Created:** [September 15, 2016, 9:41am UTC](https://discuss.elastic.co/t/how-to-log-strings-searched-in-elasticsearch/60593 "2016-09-15T09:41:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rahul16](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@rahul16](https://discuss.elastic.co/u/rahul16)
#### Post date: [September 15, 2016, 9:41am UTC](https://discuss.elastic.co/t/how-to-log-strings-searched-in-elasticsearch/60593/1 "2016-09-15T09:41:03Z")

</div>

In elasticsearch how can i log and keep trace of the strings that are being searched so that i can analyse it later.  
Suppose a user is searching "black shoes". How can i log this information?

---

<div class="post-metadata">

### Author: ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)
#### Post date: [September 15, 2016, 12:23pm UTC](https://discuss.elastic.co/t/how-to-log-strings-searched-in-elasticsearch/60593/2 "2016-09-15T12:23:32Z")

</div>

Hi,

there's a workaround beeing discussed in this [issue](https://github.com/elastic/elasticsearch/issues/9172), but this will give you full queries and is a bit of a misuse of the slow query log. Usually people do this kind of logic in their application layer (its usually not a good idea to let the users of your search solution directly access ES, instead you usually have some sort of "translation" from what users type into a search box to the actual queries that are sent to ES. This is where I'd log this kind of information).

Cheers

---

<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:20pm UTC](https://discuss.elastic.co/t/how-to-log-strings-searched-in-elasticsearch/60593/3 "2017-07-05T22:20:00Z")

</div>


