Elastic Seach - NEST - filter top N documents by score and then sort by field

I'm using Elastic Search with Nest 5.6, I would like to filter only 100 documents with the highest Score and then sort by any other field. The problem is that sorting is done together between the score and the field, but I'd like to sort ONLY the TOP (N) records with the highest score.
For example, ordering by Score and the lower value of the item results in the table below:

  • Score | Item Value
  • 0.8 | 7.0
  • 0.8 | 8.0
  • 0.7 | 6.0 - this price shold be the first.

My query follows below:

 client.Search<ItemDto>(s => s
		   .Query(q => q                        
			  .Bool(b => b.Must(query)))
			.Field(f=>f.Field(new Field("itemValue")).Ascending())

Anyone have any ideas on how to solve this problem?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.