Skip to content

Instantly share code, notes, and snippets.

@sohangp
Last active June 20, 2019 15:01
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 sohangp/ebaf716e4af9cf634883f06a273a44d3 to your computer and use it in GitHub Desktop.
Save sohangp/ebaf716e4af9cf634883f06a273a44d3 to your computer and use it in GitHub Desktop.
Insert all the 9 Children
# Insert Children for Darren
curl -X PUT \
'http://localhost:9200/family_tree/_bulk?routing=Darren' -H 'content-type: application/json' \
-d '
{"index": {"_type": "_doc", "_id": "4"}}
{"firstName":"Otis", "lastName":"Ford", "gender":"Male", "isAlive":false, "relation_type":{ "name":"child", "parent":"1" } }
{"index": {"_type": "_doc", "_id": "5"}}
{"firstName":"Pearl", "lastName":"Ford", "gender":"Female", "isAlive":true, "relation_type": { "name":"child", "parent":"1" } }
{"index": {"_type": "_doc", "_id": "6"}}
{"firstName":"Ava", "lastName":"Ford", "gender":"Female", "isAlive":true, "relation_type": { "name":"child", "parent":"1" } }
{"index": {"_type": "_doc", "_id": "7"}}
{"firstName":"Tyler", "lastName":"Ford", "gender":"Male", "isAlive":true, "relation_type": { "name":"child", "parent":"1" } }
{"index": {"_type": "_doc", "_id": "8"}}
{"firstName":"Xavier", "lastName":"Ford", "gender":"Male", "isAlive":true, "relation_type": { "name":"child", "parent":"1" } }
'
# Insert Children for Sienna
curl -X PUT \
'http://localhost:9200/family_tree/_bulk?routing=Sienna' -H 'content-type: application/json' \
-d '
{"index": {"_type": "_doc", "_id": "9"}}
{"firstName":"Ralph", "lastName":"Evans", "gender":"Male", "isAlive":true, "relation_type":{ "name":"child", "parent":"2" } }
'
# Insert Children for Ryan
curl -X PUT 'http://localhost:9200/family_tree/_bulk?routing=Ryan' -H 'content-type: application/json' \
-d '
{"index": {"_type": "_doc", "_id": "10"}}
{"firstName":"Fred", "lastName":"Turner", "gender":"Male", "isAlive":true, "relation_type":{ "name":"child", "parent":"3" } }
{"index": {"_type": "_doc", "_id": "11"}}
{"firstName":"Scarlet", "lastName":"Turner", "gender":"Female", "isAlive":false, "relation_type":{ "name":"child", "parent":"3" } }
{"index": {"_type": "_doc", "_id": "12"}}
{"firstName":"Wayne", "lastName":"Turner", "gender":"Male", "isAlive":true, "relation_type":{ "name":"child", "parent":"3" } }
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment