I'm trying to construct a query against my index that will use function_score
to boost records where fields have certain values. In Kibana Dev Tools, I have the following query that returns 3 hits as expected:
GET /myindex/_search
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "somename",
"fields": ["licenseName", "businessName"]
}
}
}
}
}
But when I try to reproduce this with NEST
, no filtering happens, and it just returns all records in the index. To me this looks equivalent, but I must be missing something:
var byNameSearchResult = await _elasticClient.SearchAsync<MyModel>(sr => sr
.Index("myindex")
.Query(qcd => qcd
.FunctionScore(fsqd => fsqd
.Query(fsqcd => fsqcd
.MultiMatch(mmqd => mmqd
.Query(message.Name)
.Fields(fd => fd
.Field(f => f.LicenseName)
.Field(f => f.BusinessName)
)
)
)
)
)
);
Any ideas on what I'm missing in the NEST
query that would make it function like the raw query in Dev Tools?