Last active
February 7, 2022 21:11
-
-
Save adhendo/bac8f5a4d7624963b9db32ecee76d499 to your computer and use it in GitHub Desktop.
Command line script for bulk json file indexing to Elastic Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat example.json | jq -c -r '.[] | {"index": {"_index": "index_name", "_type": "_doc", "_id": .id}}, .' | curl -XPOST -H "Content-Type: application/json" https://elastic_search_url/index_name/_bulk --data-binary @- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example.json
refers to your json file you want to index, replaceindex_name
with the name of your index,.id
can be whatever property you want from your json file, finally replaceelastic_search_url/index_name
with your elastic search url and index name respectively.