Skip to content

Instantly share code, notes, and snippets.

@renshuki
Last active March 4, 2024 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save renshuki/2b89ab2258a6d22200218046dd0231fe to your computer and use it in GitHub Desktop.
Save renshuki/2b89ab2258a6d22200218046dd0231fe 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