Skip to content

Instantly share code, notes, and snippets.

Created March 20, 2012 14:59
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 anonymous/2136557 to your computer and use it in GitHub Desktop.
Save anonymous/2136557 to your computer and use it in GitHub Desktop.
parent child facet using scope
curl -X POST "http://localhost:9200/myindex/ParentType/_search?pretty=true" -d '
{
"query": {
"has_child" : {
"_scope" : "myscope",
"type" : "ChildType",
"query" : {
"match_all" : {}
}
}
},
"facets" : {
"scope" : "myscope",
"title" : { "terms" : {"field" : "title"} }
}
}
'
curl -X POST "http://localhost:9200/myindex/ParentType/_search?pretty=true" -d '
{
"query": {
"has_child" : {
"_scope" : "myscope",
"type" : "ChildType",
"query" : {
"match_all" : {}
}
}
},
"facets" : {
"scope" : "myscope",
"titles" : { "terms" : {"field" : "titles"} }
}
}
'
{
"ParentType": {
"properties": {
"titles": {
"type": "string",
"index": "not_analyzed"
},
"version": {
"type": "integer"
}
}
}
}
--------------------------------------------------------------------------------
{
"ChildType": {
"_parent": {
"type": "ParentType"
},
"_routing": {
"required": true
},
"properties": {
"title": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment