Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created March 4, 2013 10:44
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 radu-gheorghe/5081445 to your computer and use it in GitHub Desktop.
Save radu-gheorghe/5081445 to your computer and use it in GitHub Desktop.
Elasticsearch: 2 children with the same ID, but with different parents
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/parent/1 -d '{"foo": "p_foo1"}'
curl -XPUT localhost:9200/test/parent/2 -d '{"foo": "p_foo1"}'
curl -XPUT localhost:9200/test/child/_mapping -d '{
"child": {
"_parent": {
"type": "parent"
}
}
}'
curl -XPUT localhost:9200/test/child/id1?parent=1 -d '{"foo": "c1"}'
curl -XPUT localhost:9200/test/child/id1?parent=2 -d '{"foo": "c2"}'
curl -XPOST localhost:9200/test/_refresh
curl -XPOST localhost:9200/test/child/_search?pretty -d '{"fields": ["_parent","_source"]}'
curl -XGET localhost:9200/test/child/id1?routing=1
curl -XGET localhost:9200/test/child/id1?routing=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment