This blog post shows you how to export data from Elasticsearch to a CSV file. Imagine that you have infrastructure or security log data in Elasticsearch that you would like to export as a CSV and open in Excel or other tools for further analysis. In this post, we’ll introduce the ways to export Elasticsearch data to a CSV using the top available tools on the market.
There are multiple ways you can extract data from Elasticsearch. We will look at the following scenarios:
We wrote an honest and unbiased review of the following tools that are available for exporting data directly from Elasticsearch.
Es2csv is the command-line utility, written in Python, for querying Elasticsearch in Lucene query syntax or Query DSL syntax and exporting the results as documents into a CSV file. This tool can query bulk docs in multiple indices and get only selected fields, which reduces query execution time.
Here are the major pros and cons of es2csv :
Here are the most essential advantages of es2csv.
After the advantages, it’s time to throw some light on the disadvantages of es2csv.
One of the advantages of having a flexible database and using Python’s Pandas Series is being able to export documents in a variety of formats. When you use Pandas IO Tools Elasticsearch to export Elasticsearch files in Python, you can analyze documents faster.
This requires the following prerequisites
Here are the major pros and cons of python pandas.
This is an elastic search plugin. You need to add and configure it into your elasticsearch plugins. It provides a feature to download the response of a search result in several formats other than JSON. The supported formats are CSV, Excel and JSON(Bulk).
For this, there are the following prerequisites
Here are the major pros and cons of the Elasticsearch Data format.
When we tried these tools, we were unable to export only the fields that are given in the query. So it takes all the values in the index. Whereas, with products like Skedler Reports, Kibana, and Grafana, it is possible to export the selected fields as a CSV/Excel file. Furthermore, only python pandas works with the latest versions of elasticsearch(>5.x). Last, but not least, a major drawback of these open source tools is that they are designed for use by technical users.
If you are looking for an easy and automated way to export Elastic Stack data to CSV, XLS or PDF, we invite you to try Skedler Reports. It is free to try for 21 days, and it could save you a ton of time. You can download Skedler Reports here.
Subscribe To Receive The Latest Insights