# Throttle Kibana Queries to Elasticsearch

**URL:** <https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339>\
**Category:** Kibana\
**Created:** [March 20, 2020, 2:51am UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339 "2020-03-20T02:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffzhao](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jeffzhao](https://discuss.elastic.co/u/jeffzhao)\
**Post date:** [March 20, 2020, 2:51am UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/1 "2020-03-20T02:51:35Z")

</div>

Hi,

In my Elasticsearch+Kibana environment, sometimes, user submitted heavy queries which blow up Elasticsearch cluster after CPU on the data node spiked to 100%.

I know there is room to optimize the query and I know there is no way to throttle Search inside Elasticsearch. I want to know if there is a way to throttle Kibana queries based on certain criteria, such as Elasticsearch cluster CPU usage.

There are two groups of Kibana user: power user and casual user. Ideally I want to set quota of CPU usage for each group.

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [March 20, 2020, 3:42pm UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/2 "2020-03-20T15:42:59Z")

</div>

Hey @jeffzhao,

We don't currently have a mechanism to throttle Kibana requests based on ES cluster stats, however, you might be interested in following some of the work we are doing around async search, which will eventually give users the ability to [send a long-running search to the background](https://github.com/elastic/kibana/issues/46370).

As that feature evolves, we are thinking of moving toward giving admins the ability to view all in-progress async queries, as well as cancel queries that have been running too long, or that are impacting the cluster performance in some way.

There's also the [`elasticsearch.requestTimeout`](https://www.elastic.co/guide/en/kibana/current/settings.html) setting which you can adjust as a failsafe if the CPU spike is also corresponding to slower response times.

If these don't meet your needs, I'd encourage you to [submit a feature request](https://github.com/elastic/kibana/issues/new?template=Feature_request.md) with your idea so that we can share it with the team more widely!

Thanks -

Luke

---

<div class="post-metadata">

**Author:** ![jeffzhao](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jeffzhao](https://discuss.elastic.co/u/jeffzhao)\
**Post date:** [March 20, 2020, 4:16pm UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/3 "2020-03-20T16:16:51Z")

</div>

Thanks Luke.

I checked elasticsearch.requestTimeout: 300000 in my environment. But I still have queries running 50+ minutes. Is this possible?

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [March 20, 2020, 5:51pm UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/4 "2020-03-20T17:51:45Z")

</div>

It is possible depending on what version of the stack you are running -- there was an issue [fixed in 7.4](https://github.com/elastic/kibana/pull/42764) where queries disconnected from Kibana were not also being canceled in Elasticsearch.

---

<div class="post-metadata">

**Author:** ![jeffzhao](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jeffzhao](https://discuss.elastic.co/u/jeffzhao)\
**Post date:** [March 20, 2020, 6:00pm UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/5 "2020-03-20T18:00:48Z")

</div>

okay. That makes sense. I'm using a very old version 4.1.

---

<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:** [April 17, 2020, 6:01pm UTC](https://discuss.elastic.co/t/throttle-kibana-queries-to-elasticsearch/224339/6 "2020-04-17T18:01:03Z")

</div>

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