Skip to content

Instantly share code, notes, and snippets.

@denzhel
Last active January 26, 2021 13:15
Show Gist options
  • Save denzhel/24f38638b8b84d1c5acaf9a0f3389919 to your computer and use it in GitHub Desktop.
Save denzhel/24f38638b8b84d1c5acaf9a0f3389919 to your computer and use it in GitHub Desktop.
Elasticsearch download all documents from an index

To download all documents from an index, first you need to create a search ID:

curl -X POST "localhost:9200/<indexName>/_search?scroll=5m&pretty&size=10000"

This will keep a search session for 5 minutes

Then, send another query to scroll through the pages of data until there is no more:

curl -X GET "localhost:9200/_search/scroll?pretty&scroll=5m&scroll_id=<searchIdFromThePreviousStep>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment