I have the following query. I need to add boost factor when the pubdate is greater than 2013-01.
How can I achieve that?
curl -XGET 'http://localhost:9200/cs/test/_search?pretty=true' -d '
{
"from" : 0,
"size" : 10,
"query" : {
"function_score" : {
"query" : {
"filtered" : {
"query" : {
"multi_match" : {
"query" : "java",
"fields" : [ "title" ]
}
},
"filter" : {
"and" : {
"filters" : [ {
"terms" : {
"dbname" : [ "pubs", "pub2"]
}
}, {
"range" : {
"pubdate" : {
"from" : "1980-01",
"to" : "2015-06",
"include_lower" : true,
"include_upper" : true
}
}
} ]
}
}
}
},
"functions" : [ {
"filter" : {
"terms" : {
"dbname" : [ "pub2" ]
}
},
"boost_factor" : -10.0
} ]
}
},
"sort" : [ {
"_score" : {
"order" : "desc"
}
}, {
"pubdate" : {
"order" : "desc"
}
} ]
}'