# Search.queue size too high for a single query

**URL:** https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495
**Category:** Elasticsearch
**Created:** [April 15, 2016, 11:35am UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495 "2016-04-15T11:35:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JD557](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jd557/32/9112_2.png) [@JD557](https://discuss.elastic.co/u/JD557)
#### Post date: [April 15, 2016, 11:35am UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495/1 "2016-04-15T11:35:26Z")

</div>

After doing some monitoring using `_cat/thread_pool`, I've been noticing that some of my search queries spawn a huge number of entries in the `search.queue`, which leads to a bunch of rejected searches.

The numbers in `search.active` seems to be correct (they seem to be the number of search queries that I'm executing), but what is the number `search.queue`? Why is it so big (~800) for a single query?

Is the number of elements in the queue larger for queries with more indices or that need to hit more shards?

How can I change my queries to reduce this number?

(I'm using elasticsearch 2.2.0)

Thanks

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 16, 2016, 8:30pm UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495/2 "2016-04-16T20:30:25Z")

</div>

What does the query look like?  
How are you issuing it to the cluster?

---

<div class="post-metadata">

### Author: ![JD557](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jd557/32/9112_2.png) [@JD557](https://discuss.elastic.co/u/JD557)
#### Post date: [April 16, 2016, 11:45pm UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495/3 "2016-04-16T23:45:06Z")

</div>

I've seen this happen with multiple queries, but here's one such example:

[http://pastebin.com/v2bnzt0P](http://pastebin.com/v2bnzt0P)

(This query is executed on multiple indices using a wildcard).

The queries are being sent to the cluster via the elastic4s scala client (which is just a wrapper to the java client, AFAIK).

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [April 18, 2016, 1:41pm UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495/4 "2016-04-18T13:41:18Z")

</div>

This could happen if you are either querying many indices, or if your indices have too many shards.

---

<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:58pm UTC](https://discuss.elastic.co/t/search-queue-size-too-high-for-a-single-query/47495/5 "2017-07-05T22:58:30Z")

</div>


