This is an English translation of a Japanese blog. Some content may not be fully translated.
AWS

Exporting Amazon Elasticsearch Service Search Results as CSV

Prerequisites

Install the jq command and in2csv (included in csvkit, converts JSON output to CSV) beforehand. A Python environment is also required.

sudo yum -y install jq
pip install csvkit

Get Elasticsearch Results in CSV Format

curl https://vpc-xxxxxxx-xxxxxx.ap-northeast-1.es.amazonaws.com/xxxxxxx/_search?pretty | jq [.hits.hits[]._source] | in2csv -f json
Suggest an edit on GitHub