Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goors/e6932928370157989c0fdbdf3258959e to your computer and use it in GitHub Desktop.
Save goors/e6932928370157989c0fdbdf3258959e to your computer and use it in GitHub Desktop.
Elasticsearch - Bulk index from a JSON file hits (with jq)
cat file.json | jq -c '.hits.hits[] | { index: {_index:._index, _type:._type, _id:._id}}, ._source' | curl -XPOST -H "Content-Type: application/x-ndjson" localhost:9200/_bulk --data-binary @- | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment