# TermsQuery(TermInSetQuery) Performance

**URL:** <https://discuss.elastic.co/t/termsquery-terminsetquery-performance/159879>\
**Category:** Elasticsearch\
**Created:** [December 7, 2018, 8:27am UTC](https://discuss.elastic.co/t/termsquery-terminsetquery-performance/159879 "2018-12-07T08:27:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ananth](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ananth](https://discuss.elastic.co/u/ananth)\
**Post date:** [December 7, 2018, 8:27am UTC](https://discuss.elastic.co/t/termsquery-terminsetquery-performance/159879/1 "2018-12-07T08:27:10Z")

</div>

My field value is a random id and there is no place for prefix coding of query terms and my index having large of matching documents for each values in the termsquery . I would like to know whether memory usage is linear to the number of values (each matching huge doc ids) given in the termsquery ? Though the roaring bitmaps are in action the default limit of 65536 seems to be bit higher. Please correct me if i am wrong.

---

<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:** [January 4, 2019, 8:27am UTC](https://discuss.elastic.co/t/termsquery-terminsetquery-performance/159879/2 "2019-01-04T08:27:10Z")

</div>

Closed on January 4, 2019, 8:27am UTC

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