elasticsearch - weight function_score functions in Elastic Search -
i want weight each function in function_score differently. have regular text query mixed date based decay , geo query. want cut down weighting on date based decay. on old docs saw scale_weight alternative function_score, don't see more. here query:
"query": { "function_score": { "query": { "query_string": { "query": "my query", "default_operator": "or" } }, "functions": [ { "script_score": { "script": "_score * doc[\"rgscore\"].value" } }, { "gauss": { "location": { "origin": { "lat": 49.4928119, "lon": -117.2948343 }, "scale": "100km", "offset": "10km", "decay": 0.5 } } }, { "exp": { "start": { "origin": "2014-06-20", "scale": "90d", "offset": "0d", "decay": 0.01 } } } ], "filter": { "range": { "start": { "gte": "2014-06-20" } } } } },
the documentation function score query describes how this, , can check out this tutorial.
in summary, can add together weight (for versions after 1.4.0.beta1) or boost_factor (for versions before that) property each function, , modify contribution of each clause appropriately.
for case, like:
{ "exp": { "start": { "origin": "2014-06-20", "scale": "90d", "offset": "0d", "decay": 0.01 } }, "weight" : 0.2 } should work - if have version prior 1.4.0.beta1, seek replacing "weight" "boost_factor."
the weight relative other function clauses, may have adjust results want.
elasticsearch
No comments:
Post a Comment