# Array size inside of terms query cannot exceed 1000 indices

**URL:** <https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945>\
**Category:** Elasticsearch\
**Created:** [July 25, 2013, 5:55pm UTC](https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945 "2013-07-25T17:55:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannalieth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dannalieth/32/2258_2.png) [@dannalieth](https://discuss.elastic.co/u/dannalieth)\
**Post date:** [July 25, 2013, 5:55pm UTC](https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945/1 "2013-07-25T17:55:31Z")

</div>

I have a query like so:

"filter": { "query": { "terms": { "user": ["jonh", "doe", ..., "asdf"]} } }

The number of users in the array is arbitrarily big for our use case. However, ElasticSearch seems to fail with "SearchPhaseExecutionException[Failed to execute phase [query], total failure; when the size of the array surpasses 1027.

Is this the expected behavior? If so, is there a way to increase the size of the accepted array?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 28, 2013, 8:25am UTC](https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945/2 "2013-07-28T08:25:07Z")

</div>

Hey,

just as a side node, the terms filter lookup functionality may help you a  
lot, see

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--Alex

On Thu, Jul 25, 2013 at 7:55 PM, dannalieth [diran.d.li@gmail.com](mailto:diran.d.li@gmail.com) wrote:

> I have a query like so:
> 
> "filter": { "query": { "terms": { "user": ["jonh", "doe", ..., "asdf"]} } }
> 
> The number of users in the array is arbitrarily big for our use case.  
> However, Elasticsearch seems to fail with  
> "SearchPhaseExecutionException[Failed to execute phase [query], total  
> failure; when the size of the array surpasses 1027.
> 
> Is this the expected behavior? If so, is there a way to increase the size  
> of  
> the accepted array?
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Array-size-inside-of-terms-query-cannot-exceed-1000-indices-tp4038659.html](http://elasticsearch-users.115913.n3.nabble.com/Array-size-inside-of-terms-query-cannot-exceed-1000-indices-tp4038659.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Vicente\_de\_Rivera\_II](https://avatars.discourse-cdn.com/v4/letter/v/898d66/32.png) [@Vicente\_de\_Rivera\_II](https://discuss.elastic.co/u/Vicente_de_Rivera_II)\
**Post date:** [March 23, 2016, 6:58am UTC](https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945/3 "2016-03-23T06:58:20Z")

</div>

I hope it's okay to necro this topic. My question is for this topic.

When using the terms lookup mechanism, is the filter cached? I have like 10,000 list string values (account names) that can change every X minutes (may 5 to 15 minutes). This list is a list of account names that are online, hence they can change at least every 15mins.

Taken from the [doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html)(2.x):

> Also, consider using an index with a single shard and fully replicated across all nodes if the "reference" terms data is not large

Does 10,000 considered as large?

---

<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, 11:05pm UTC](https://discuss.elastic.co/t/array-size-inside-of-terms-query-cannot-exceed-1000-indices/12945/4 "2017-07-05T23:05:59Z")

</div>


