Skip to content

Instantly share code, notes, and snippets.

@gboivin
Last active December 20, 2015 00:19
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 gboivin/59ccd243c8259e53cb16 to your computer and use it in GitHub Desktop.
Save gboivin/59ccd243c8259e53cb16 to your computer and use it in GitHub Desktop.
Boosting an or clause in a custom score filter
{
"explain": true,
"from": 0,
"size": 50,
"query": {
"custom_filters_score": {
"query": {
"bool": {
"must": [
{
"term": {
"category.id": 1225
}
}
]
}
},
"filters": [
{
"filter": {
"or": [
{
"query": {
"match": {
"title": {
"query": "Nike",
//This boost is not getting applied
"boost": 2,
"operator": "and"
}
}
}
},
{
"query": {
"match": {
"title": {
"query": "Adidas",
//This boost is not getting applied
"boost": 1,
"operator": "and"
}
}
}
}
]
},
"boost": 10
},
{
"filter": {
"range": {
"savings": {
"from": "50",
"include_lower": true
}
}
},
"boost": 5
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment