Hello,
is it possible to do a BucketSort of an aggregation based on score rather than on document count (using Flunet interface of Nest 6.5)?
E.g., like in following query where I want to get all directors that are spelled similarly to "Scorsese". All elements within each bucket should have the same score, since the query only contains the field name "Director" that is also used for aggregation.
this.elasticClient
.SearchAsync<Movies>(
s => s
.Index(Titles)
.Size(0)
.Aggregations(a => a
.Terms("directors", t => t
.Field(f => f
.Director
.Suffix("keyword"))
.Size(maxResults)))
.Query(q => q
.Bool(b =>
b = b.Must(
must =>
must.Match(m => m
.Field(f => f.Director)
.Query("Scorsese")
.Fuzziness(Fuzziness.Auto)
)))));
The output is correct but the ordering is based on the document count. As long as one is looking for "Scorsese" everything is fine but if you are looking for someone spelled similarly you would still get "Scorsese" as top hit even if you spelled the name you are looking for correctly.
If I do a BucketSort on score I get an error response telling me that this is not allowed. If there is no way to sort the buckets on their score then my whole design is flawed.
Thanks,
Art