Weight 100 | Weight 10 |
---|---|
listen>10k | listen>10k |
publish date>01/01/21 | publish date>01/01/20 |
I tried adding weights separately for publish date but face a challenge when there is same amount of listens. Any help will be appreciated.
Below the query I have tried so far:
{
"query" : {
"boosting" : {
"positive" : {
"function_score" : {
"query" : {
"dis_max" : {
"queries" : [
{ "match" :
{ "category.name" :
{
"query" : "TV & Film",
"boost" : 1
}
}
}
]
}
},
"functions" : [{"filter": {
"range" : { "publishTime": { "gte" : "now-7d", "lte" : "now" } }} ,
"weight": 1000
},
{"filter": {
"range" : { "publishTime": { "gte" : "now-15d", "lt" : "now-7d" } }} ,
"weight": 100
},
{"filter": {
"range" : { "publishTime": { "gte" : "now-30d", "lt" : "now-15d" } }} ,
"weight": 10
},
{"filter": {
"range" : { "publishTime": {"lt" : "now-30d" } }} ,
"weight": 1
},
{"filter": {
"range" : { "listen": { "lt" : "10000", "gte" : "1000" } }} ,
"weight": 1000
},{"filter": {
"range" : { "listen": { "lt" : "100000", "gte" : "10000"} }} ,
"weight": 100
},{"filter": {
"range" : { "listen": { "lt" : "1000000", "gte" : "100000" } }} ,
"weight": 10
},{"filter": {
"range" : { "listen": { "lt" : "10000000", "gte" : "1000000" } }} ,
"weight": 1
}
]
}
},
"negative" : {
"match" : { "studio" : "false" }
},
"negative_boost" : 0.1
}
}
}
Expected search link has been attached. Also, can you please help to vary the score from each other [1]: https://i.stack.imgur.com/UkW5N.png
Thanks