Skip to content

Instantly share code, notes, and snippets.

@dedico
Created July 8, 2012 12:49
Show Gist options
  • Save dedico/3070809 to your computer and use it in GitHub Desktop.
Save dedico/3070809 to your computer and use it in GitHub Desktop.
incorrect elasticsearch query
{
"query":{
"bool":{
"must":[
{
"match_all":{ }
},
{
"term":{
"vehicles.vehicle_category_id":{
"term":"1"
}
}
},
{
"term":{
"vehicles.make_id":{
"term":"71"
}
}
},
{
"term":{
"vehicles.model_id":{
"term":"1819"
}
}
}
]
}
},
"facets":{
"power":{
"terms":{
"field":"vehicles.power_km",
"size":1000,
"all_terms":true
}
},
"capacity":{
"terms":{
"field":"vehicles.engine_capacity",
"size":1000,
"all_terms":false,
"facet_filter":{
"term":{
"vehicles.power_km":"105"
}
}
}
}
},
"filter":{
"and":[
{
"term":{
"vehicles.power_km":"105"
}
},
{
"term":{
"vehicles.engine_capacity":"1781"
}
}
]
},
"size":30,
"from":0
}
@dedico
Copy link
Author

dedico commented Jul 8, 2012

Trying to apply facet filter (https://gist.github.com/3070809) on 'capacity' facet, I get incorrect results - looks like the query is ignoring the filter for some reason....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment