Skip to content

Instantly share code, notes, and snippets.

@gjb83
Created March 26, 2013 01:01
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 gjb83/22581de7fe8179325a5a to your computer and use it in GitHub Desktop.
Save gjb83/22581de7fe8179325a5a to your computer and use it in GitHub Desktop.
How can I exclude the price filter from the calculation of the price_ranges facet? In other words, the price_ranges facet should take into account all of the filters except for price.
{
query : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"and" : [
{
"term" : {
"colour" : "Red"
}
},
{
"term" : {
"feature" : "Square"
}
},
{
"term" : {
"feature" : "Shiny"
}
},
{
"range" : {
"price" : {
"from" : "10",
"to" : "20"
}
}
}
]
}
}
},
"facets" : {
"colours" : {
"terms" : {
"field" : "colour"
}
},
"features" : {
"terms" : {
"field" : "feature"
}
},
"price_ranges" : {
"statistical" : {
"field" : "price"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment