How to export an entire Elastic Search index to a csv file


We have an Elasticsearch index that has approximately 1 million records in it.
We'd like to export only two fields from it, and ID (int) and a Value (string) for auditing purposes.

We've tried using es2csv, but it doesn't appear to work.
What is the simplest way to export data from ES, a whole index, all rows?
If there is a template Python example or something like that (or an out of the box method), we're interested, thanks!

Out of box method could be to use Logstash.

Input - Read index from index and use DSL query to only get the 2 fields needed
Output - CSV

May need a CSV Filter, not sure if the output can convert or not.

Thank you Aaron!

Sorry, I'm not sure if you're pointing to multiple methods or just one.
Are you saying to use Logstash with Elastic Dump or either/or?"

I read documentation about Elastic Dump, but wasn't sure if it automatically polls the whole index and downloads it to the specified output.

Just 1 method using Logstash. Not sure what Elastic Dump is.

Logstash will essentially read your entire index of 1 million records and write it to disk in CSV format. The links in my post above are which plugins to use but I would start reading my first link about Logstash first.

1 Like

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