# Performance issues when returning many ids

**URL:** <https://discuss.elastic.co/t/performance-issues-when-returning-many-ids/274618>\
**Category:** Elasticsearch\
**Created:** [June 1, 2021, 10:52am UTC](https://discuss.elastic.co/t/performance-issues-when-returning-many-ids/274618 "2021-06-01T10:52:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristian\_Andersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kristian_andersen/32/89586_2.png) [@Kristian\_Andersen](https://discuss.elastic.co/u/Kristian_Andersen)\
**Post date:** [June 1, 2021, 10:52am UTC](https://discuss.elastic.co/t/performance-issues-when-returning-many-ids/274618/1 "2021-06-01T10:52:46Z")

</div>

Hello,  
I have a search index with 200.000 documents, and experience bad performance when performing searches that returns multiple results.

Each document consists of 1040 fields all mapped as keywords. See filemapping below.

When performing a query that returns approx 140.000 ids, the "took" time from elastic is around 10.000ms.

Is there anything obviously wrong with this setup / way of indexing documents?

I am aware of the fact that using from: 0, to:1000000 is not ideal, but if i use a PIT, and fetches in batches, it takes approx 1100ms pr batch of 10000 documents, which gives a total time spent on ~15.000ms

![mapping](https://us1.discourse-cdn.com/elastic/original/3X/5/a/5a6ef56deac23a1f8eecb6ae2c41fec65801ddc9.png)

 ![index](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e7dddd4dfeb6872fc9ee2010a4b3228e699a583c.png)  
 ![query](https://us1.discourse-cdn.com/elastic/original/3X/1/5/157f027edbd502a77cd3df79171bd5588aaf832b.png)  
 ![time](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e029fb825fa1dd645fa858d81c8b5a10244c0afe.png)

---

<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:** [June 29, 2021, 10:53am UTC](https://discuss.elastic.co/t/performance-issues-when-returning-many-ids/274618/2 "2021-06-29T10:53:15Z")

</div>

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