What is the fastest way to get all _ids of a certain index from ElasticSearch? Is it possible by using a simple query? One of my index has around 20,000 documents.
Efficient way to retrieve all _ids in ElasticSearch
elasticsearch
elasticsearch
What is the fastest way to get all _ids of a certain index from ElasticSearch? Is it possible by using a simple query? One of my index has around 20,000 documents.
Best Answer
Edit: Please read @Aleck Landgraf's Answer, too
You just want the elasticsearch-internal
_id
field? Or anid
field from within your documents?For the former, try
Note 2017 Update: The post originally included
"fields": []
but since then the name has changed andstored_fields
is the new value.The result will contain only the "metadata" of your documents
For the latter, if you want to include a field from your document, simply add it to the
fields
array