# Is there any APIs to fetch query history?

**URL:** <https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131>\
**Category:** Elasticsearch\
**Created:** [February 20, 2020, 8:45am UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131 "2020-02-20T08:45:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wendy](https://avatars.discourse-cdn.com/v4/letter/w/2bfe46/32.png) [@wendy](https://discuss.elastic.co/u/wendy)\
**Post date:** [February 20, 2020, 8:45am UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/1 "2020-02-20T08:45:41Z")

</div>

Hi all,

I'd like to access the query history of users by invoking API for analyzing the user behavior.  
Does Elastic Search provide such an API for fetching query history? Any comment is greatly appreciated.

Best Regards  
Wendy

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [February 21, 2020, 1:17am UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/2 "2020-02-21T01:17:51Z")

</div>

Hi @wendy, there is no such API in Elasticsearch for this

---

<div class="post-metadata">

**Author:** ![wendy](https://avatars.discourse-cdn.com/v4/letter/w/2bfe46/32.png) [@wendy](https://discuss.elastic.co/u/wendy)\
**Post date:** [February 21, 2020, 1:47am UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/3 "2020-02-21T01:47:24Z")

</div>

Thanks for your reply.  
I'd like to get the query history of user in kibana for analyzing the user behavior. Do you have any suggestions?

Best Regards  
Wendy

---

<div class="post-metadata">

**Author:** ![Muhammad\_Ariful\_Isla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muhammad_ariful_isla/32/55732_2.png) [@Muhammad\_Ariful\_Isla](https://discuss.elastic.co/u/Muhammad_Ariful_Isla)\
**Post date:** [March 2, 2020, 12:21pm UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/4 "2020-03-02T12:21:29Z")

</div>

Hi @forloop ,  
Is there any other way to achive it? I mean if an malicious/naive user used `-X DELETE`, how can I prove that the data deletion was not administrator's fault?

---

<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:** [March 2, 2020, 1:08pm UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/5 "2020-03-02T13:08:12Z")

</div>

IMO the best thing to do is to secure your cluster.  
Don't let users who should just read data be able to write or delete.

---

<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:** [March 30, 2020, 1:08pm UTC](https://discuss.elastic.co/t/is-there-any-apis-to-fetch-query-history/220131/6 "2020-03-30T13:08:17Z")

</div>

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