Skip to content

Instantly share code, notes, and snippets.

@glenacota
Created March 15, 2023 14:12
Show Gist options
  • Save glenacota/f62f007631f6a019fe1c6db55e9fd300 to your computer and use it in GitHub Desktop.
Save glenacota/f62f007631f6a019fe1c6db55e9fd300 to your computer and use it in GitHub Desktop.
curl --location --request PUT '127.0.0.1:9200/_bulk' \
--header 'Content-Type: application/json' \
--data-binary @- << EOF
{ "create" : { "_index" : "movies", "_id" : "135569" } }
{ "id": "135569", "title" : "Star Trek Beyond", "year":2016 , "genre":["Action", "Adventure", "Sci-Fi"] }
{ "create" : { "_index" : "movies", "_id" : "122886" } }
{ "id": "122886", "title" : "Star Wars: Episode VII - The Force Awakens", "year":2015 , "genre":["Action", "Adventure", "Fantasy", "Sci-Fi", "IMAX"] }
{ "create" : { "_index" : "movies", "_id" : "109487" } }
{ "id": "109487", "title" : "Interstellar", "year":2014 , "genre":["Sci-Fi", "IMAX"] }
{ "create": { "_index" : "movies", "_id" : "58559" } }
{ "id": "58559", "title": "Dark Knight, The", "year":2008 , "genre":["Action", "Crime","Drama", "IMAX"] }
{ "create" : { "_index" : "movies", "_id" : "1924"} }
{ "id": "1924", "title" : "Plan 9 from Outer Space", "year":1959 , "genre":["Horror", "Sci-Fi"] }
EOF
# response
{"took":202,"errors":false,"items":[{"create":{"_index":"movies","_id":"135569","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"create":{"_index":"movies","_id":"122886","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1,"status":201}},{"create":{"_index":"movies","_id":"109487","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1,"status":201}},{"create":{"_index":"movies","_id":"58559","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":3,"_primary_term":1,"status":201}},{"create":{"_index":"movies","_id":"1924","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1,"status":201}}]}%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment