Reputation: 45155
Using the .NET Nest client for elastic search, how do I get it actually spit out the score for a named query?
I can set a name on part of my query, and it'll generate an elastic query that might look something like this:
"query": {
"bool": {
"must": [
{
"bool": {
"_name": "myMatches",
"minimum_should_match":1,
"should": [
{
"terms": {
"foo":["a"]
}
},
{
"terms": {
"bar":["b"]
}
}
]
}
},
// multiple other clauses
]
}
}
And in the kibana console, it'll spit out hits including something this:
"matched_queries": [
"myMatches"
]
But if I include this query string:
_search?include_named_queries_score
Then it'll give me scores for that named query:
"matched_queries": {
"myMatches":1
}
But in the NEST client, I'm only getting an array of names of matched named queries, there doesn't seem to be a way to get it to include the include_named_queries_score
and actually get the score in the result. Am I missing something?
var search = client.SearchAsync<MyPosts>(s => s
.Source(src => src
.Includes(i => i.Fields(fields))
)
.Query(q => q && filterQuery)
.From(from)
.Size(size)
.TrackTotalHits(true)
, cancel);
There doesn't seem to be a .IncludeNamedQueryScore
or similar. Is there support for this somewhere? Or would I have to hack around adding it to the generated query url and then handle the raw JSON response myself to make this work?
Upvotes: 0
Views: 16