Skip to content

Instantly share code, notes, and snippets.

@deverton
Created August 5, 2011 03:32
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 deverton/1126866 to your computer and use it in GitHub Desktop.
Save deverton/1126866 to your computer and use it in GitHub Desktop.
Faceting by both document and nested document
{
"rating": {
"properties" : {
"system" : {
"type" : "string",
"index" : "not_analyzed"
},
"value" : {
"type" : "float",
"null_value" : 0,
}
}
},
"availability" : {
"type" : "nested",
"properties" : {
"date" : {
"type" : "date",
"format" : "date"
},
"price" : {
"type" : "integer"
}
}
}
}
{
"query": { "match_all": {} },
"facets": {
"rating": {
"range": {
"key_field": "rating.value",
"value_field": "availability.price",
"ranges": [
{ "to": 1 },
{ "from": 1, "to": 2 },
{ "from": 2, "to": 3 },
{ "from": 3, "to": 4 },
{ "from": 5 }
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment