Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -XPUT localhost:9200/authors/bare_author/1 -d'{
- "name": "Multi G. Enre"
- }'
- curl -XPUT localhost:9200/authors/bare_author/2 -d'{
- "name": "Alastair Reynolds"
- }'
- curl -XPOST localhost:9200/authors/book/_mapping -d '{
- "book":{
- "_parent": {"type": "bare_author"}
- }
- }'
- curl -XPOST localhost:9200/authors/book/1?parent=2 -d '{
- "name": "Revelation Space",
- "genre": "scifi",
- "publisher": "penguin"
- }'
- curl -XPOST localhost:9200/authors/book/2?parent=1 -d '{
- "name": "Guns and lasers",
- "genre": "scifi",
- "publisher": "orbit"
- }'
- curl -XPOST localhost:9200/authors/book/3?parent=1 -d '{
- "name": "Dead in the night",
- "genre": "thriller",
- "publisher": "penguin"
- }'
- # just a query to test that the authors term query is working
- curl -XPOST localhost:9200/authors/bare_author/_search?pretty=true -d'{
- "query": {
- "term" : {
- "name" : "enre"
- }
- }
- }'
- # the has_parent query with the same query
- curl -XPOST localhost:9200/authors/books/_search?pretty=true -d'{
- "query": {
- "has_parent": {
- "parent_type" : "bare_author",
- "query" : {
- "term" : { "name" : "enre" }
- }
- }
- }
- }'
Advertisement
Add Comment
Please, Sign In to add comment