Skip to content

Instantly share code, notes, and snippets.

@pistocop
Last active October 22, 2020 09:37
Show Gist options
  • Save pistocop/2347e06130d526a65535f660013887d6 to your computer and use it in GitHub Desktop.
Save pistocop/2347e06130d526a65535f660013887d6 to your computer and use it in GitHub Desktop.
Elasticsearch to CSV

Elasticsearch to CSV

Roadmap:

  1. Dump index from es using elasticdump
  2. Convert to csv using json2csv
    (optional)
  3. Extract one column using csvtool
  4. Visualize the data using VisData

Code

elasticdump \
  --input=http://localhost:9100/my_index \
  --output=dump.json \
  --type=data
  
json2csv -n --flatten-objects -i dump.json -o dump.csv

# Optional
csvtool col 5,9 dump.csv > 59.csv # extract 5th and 9th columns
vd 59.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment