Created
April 11, 2016 01:23
-
-
Save xyu/305b55b385f9eafabd0fd09b81f3f0fe to your computer and use it in GitHub Desktop.
Example of Elasticsearch function scoring with gaussian decay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"function_score": { | |
"query": { | |
"multi_match": { | |
"query": "...", | |
"fields": [ | |
"title", "content", "author", | |
"tag.name", "category.name" | |
], | |
"cross_fields": true, | |
"operator": "and" | |
} | |
}, | |
"filter": { ... }, | |
"functions": [ | |
{ | |
"gauss": { | |
"origin": "now/d", | |
"scale": "7d", | |
"decay": 0.75 | |
} | |
} | |
], | |
"score_mode": "multiply", | |
"boost_mode": "multiply" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the following post on how to properly tune the decay parameters of the function score query:
https://xyu.io/2016/04/11/visualizing-elasticsearch-function-scores/