To control the score of documents based on a field value, I am using filter with function_score in my DSL query and this gets the results ordered as I expect.
However on implementing this in NEST, the results are different; the score is not applied to the filter value. From further investigation I find that some versions of C# NEST Filter is not supported with ScoreFunctionsDescriptor. Is this still the case? Can you please assist with a working option to implement this with NEST? (I am new to Elastic Search and C# so please excuse if its a noob question).
I am currently using Elasticsearch v7.6, and NEST v7.5.1.
Thanks!
DSL query
GET /help/_search
{
"query":{
"function_score": {
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "AGC",
"fields": [
"title^2",
"description^1"
],
"type":"most_fields",
"fuzziness": "AUTO:4,8",
"prefix_length": 2,
"boost": 5
}
}
]
}
},
**"functions": [**
** { **
** "filter": {**
** "term":{**
** "product":"A"**
** }**
** },**
** "weight": 45**
** },**
** { **
** "filter": {**
** "term":{**
** "product":"B"**
** }**
** },**
** "weight": 20**
** },**
** { **
** "filter": {**
** "term":{**
** "product":"C"**
** }**
** },**
** "weight": 10**
** }**
** ],**
"score_mode": "max",
"boost_mode": "multiply"
}
}
}