Following is my function_score query. I want to give additional score to documents where the product quality is better.
But _score in the search response is always 0. What am I missing? Thx.
When I remove bool query and replace it with just a term filter, the score is non zero. I am guessing it is about the query bool but can not figure out why.
Elasticsearch version is 2.4
{
"from": 0,
"size": 20,
"query": {
"function_score": {
"query": {
"bool": {
"filter": [
{
"bool": {
"should": {
"terms": {
"categories.category1Id": [
63
]
}
}
}
}
]
}
},
"functions": [
{
"gauss": {
"updatedDate": {
"origin": "2016-10-03 05:10:18",
"scale": "0.5h",
"decay": 0.1,
"offset": "1h"
}
}
},
{
"filter": {
"term": {
"productQuality": "EXCELLENT"
}
},
"weight": 7
},
{
"filter": {
"term": {
"productQuality": "HIGH"
}
},
"weight": 5
},
{
"filter": {
"term": {
"productQuality": "MEDIUM"
}
},
"weight": 3
},
{
"filter": {
"term": {
"productQuality": "LOW"
}
},
"weight": 1
}
],
"score_mode": "sum"
}
}
}