# Best way to create a list of all \_ids in an index (Up to date version)

**URL:** <https://discuss.elastic.co/t/best-way-to-create-a-list-of-all-ids-in-an-index-up-to-date-version/283195>\
**Category:** Elasticsearch\
**Created:** [September 2, 2021, 4:03pm UTC](https://discuss.elastic.co/t/best-way-to-create-a-list-of-all-ids-in-an-index-up-to-date-version/283195 "2021-09-02T16:03:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveh](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@steveh](https://discuss.elastic.co/u/steveh)\
**Post date:** [September 2, 2021, 4:03pm UTC](https://discuss.elastic.co/t/best-way-to-create-a-list-of-all-ids-in-an-index-up-to-date-version/283195/1 "2021-09-02T16:03:38Z")

</div>

So what's the current best way to query (and therefore dump to say a file) all the document \_ids in an index?

I have a 218,000 doc database with about 8000 documents missing (according to the document counts). To investigate I need a list of docs in the index to compare with those in my MariaDB to find the missing docs and try to see why they weren't indexed. I therefore just need to stream and dump to a file ready for import to Maria a list of IDs. A simple JOIN will do the rest.

There are older threads on this topic, but it seems much mentioned in the replies have been deprecated. Currently I am on 17.8

Sooo Just dump all the \_ids of all documents into a file - in 200k+ docs efficient way. No other fields required.

---

<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:** [September 3, 2021, 3:16pm UTC](https://discuss.elastic.co/t/best-way-to-create-a-list-of-all-ids-in-an-index-up-to-date-version/283195/2 "2021-09-03T15:16:08Z")

</div>

Using a point in time search or scroll search in combination with a `_doc` sorting (as you don't care about the order) might be a good idea, see [Sort search results | Elasticsearch Guide [7.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/sort-search-results.html)

Scrolling through a 218k dataset should not take too much time, so maybe no need to start optimizing but just measuring the runtime before going more fancy 🙂

---

<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:** [October 1, 2021, 3:16pm UTC](https://discuss.elastic.co/t/best-way-to-create-a-list-of-all-ids-in-an-index-up-to-date-version/283195/3 "2021-10-01T15:16:56Z")

</div>

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