# Elastic pagination for query parameters

**URL:** <https://discuss.elastic.co/t/elastic-pagination-for-query-parameters/157668>\
**Category:** Elasticsearch\
**Created:** [November 21, 2018, 9:40am UTC](https://discuss.elastic.co/t/elastic-pagination-for-query-parameters/157668 "2018-11-21T09:40:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic\_guy](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@elastic\_guy](https://discuss.elastic.co/u/elastic_guy)\
**Post date:** [November 21, 2018, 9:40am UTC](https://discuss.elastic.co/t/elastic-pagination-for-query-parameters/157668/1 "2018-11-21T09:40:59Z")

</div>

Hi,  
Say I have a terms query that potentially could include many parameters..  
for example, I have a document which looks like this:

> doc {  
> fieldA: 'id' (string, keyword type)  
> }

and I also have a list of string values {'id1', 'id2', 'id3',.........}.  
the size of the list could potentially be very big (hundreds / thousands and in a very rare cases - Tens of thousands).

and I would like to read all documents that their fieldA contained in one of a list values.

now, I have read in ES docs, that for such queries, it could be that the recommended way doing things is to fetch the parameters from an index.

> When it’s needed to specify a `terms` filter with a lot of terms it can be beneficial to fetch those term values from a document in an index  
> [Terms query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html)

but I couldn't find any reference about using a different strategy, which is - pagination - split the list to parts, each in 1K size (for example), and read in bulks of 1K.

are there any disadvantages in the pagination approach that I am missing?  
as we prefer not to store a temporary doc type only for query parameters..

Thanks

---

<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:** [December 19, 2018, 9:41am UTC](https://discuss.elastic.co/t/elastic-pagination-for-query-parameters/157668/2 "2018-12-19T09:41:11Z")

</div>

Closed on December 19, 2018, 9:41am UTC

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