Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created March 1, 2011 02:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimchy/848506 to your computer and use it in GitHub Desktop.
Save kimchy/848506 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:9200/test -d '{
"mappings" : {
"child" : {
"_parent" : {
"type" : "parent"
}
}
}
}'
curl -XPUT localhost:9200/test/parent/1 -d '{
"p_field" : "pvalue"
}'
curl -XPUT localhost:9200/test/child/1?parent=1 -d '{
"c_field" : "cvalue"
}'
curl -XPOST localhost:9200/_refresh
curl localhost:9200/test/_search?pretty=true -d '{
"query" : {
"constant_score" : {
"filter" : {
"has_child" : {
"type" : "child",
"query" : {
"term" : {
"c_field" : "cvalue"
}
}
}
}
}
}
}'
curl localhost:9200/test/parent/_search?pretty=true -d '{
"query" : {
"match_all" : {}
},
"facets" : {
"facet1" : {
"filter" : {
"has_child" : {
"type" : "child",
"query" : {
"term" : {
"c_field" : "cvalue"
}
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment