'Is it possible to use ElasticSearch query score (_score) as part of another query's function score?
I need to make a custom score function for an Elastic Search query. Part of this score is based on another query's score
For example this query will return a _score field between 0-10
{
"query": {
"multi_match" : {
"query": "someField",
"fields": "*"
}
},
"from": 0,
"size": 20
}
"hits": [
{
"_index": "index",
"_type": "_doc",
"_id": "123123",
"_score": 9.045522,
"_source": {
...
...
What I want is to utilize this _score value as part of a new query of the following form:
{
"query": {
"function_score": {
"query": {
"multi_match" : {
"query": "<search text>",
"fields": "*"
}
},
"boost": "2",
"functions": [
{
"filter": { "match": { "filterField": "filtervalue" } },
"weight": 10
},
{
<A way to use the _score and multiply it by a factor>
}
Is this even possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
