# Upper limits on terms filter array size

**URL:** <https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717>\
**Category:** Elasticsearch\
**Created:** [December 21, 2015, 8:01pm UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717 "2015-12-21T20:01:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunomiranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brunomiranda/32/746_2.png) [@brunomiranda](https://discuss.elastic.co/u/brunomiranda)\
**Post date:** [December 21, 2015, 8:01pm UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/1 "2015-12-21T20:01:30Z")

</div>

Curious if anyone know of the limitations of passing a terms filter a very large array of strings to filter one. I have tried with a few hundred and it's fine. Wondering what happens when it gets to 3-5k.

I am considering using [terms filter lookup](https://www.elastic.co/blog/terms-filter-lookup) to at least save on the http request time of posting a large JSON body, but wondering regarding the limitations of the actual search back end.

---

<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:** [December 21, 2015, 9:40pm UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/2 "2015-12-21T21:40:40Z")

</div>

I don't think elasticsearch enforces any limits here. However beware that the more terms you add to a terms filter, the slower it will get.

---

<div class="post-metadata">

**Author:** ![brunomiranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brunomiranda/32/746_2.png) [@brunomiranda](https://discuss.elastic.co/u/brunomiranda)\
**Post date:** [December 21, 2015, 9:51pm UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/3 "2015-12-21T21:51:34Z")

</div>

Thanks for the reply. Yes I haven't been cut off, but was wondering what the realistic soft-limit would be. I guess it's highly dependent on cluster/index size.

---

<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:** [December 22, 2015, 6:38am UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/4 "2015-12-22T06:38:52Z")

</div>

Basically, yes.

If you are getting into the hundreds of thousands you will probably get into trouble.

---

<div class="post-metadata">

**Author:** ![brunomiranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brunomiranda/32/746_2.png) [@brunomiranda](https://discuss.elastic.co/u/brunomiranda)\
**Post date:** [December 22, 2015, 6:50am UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/5 "2015-12-22T06:50:42Z")

</div>

Ok, will keep it around a few thousand at most.

---

<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:29pm UTC](https://discuss.elastic.co/t/upper-limits-on-terms-filter-array-size/37717/6 "2017-07-05T23:29:23Z")

</div>


