How do I get the real total when PAGING

When.NET uses NEST for paging query, when I get the total number of data from Hits, I find the maximum value is 10000, but my real data amount should be 50000+, I have set max_result_window value to 200000000, but it doesn't seem to work

Have a look at Search your data | Elasticsearch Guide [7.15] | Elastic

I have set max_result_window value to 200000000,

Don't do that. You are going to put a lot of pressure on the HEAP.

If you are asking about extracting all the resultset, you can use:

  • the size and from parameters to display by default up to 10000 records to your users. If you want to change this limit, you can change index.max_result_window setting but be aware of the consequences (ie memory).
  • the search after feature to do deep pagination.
  • the Scroll API if you want to extract a resultset to be consumed by another tool later. (Not recommended anymore)

If you're after just the total number of hits to be accurate, you can set TrackTotalHits to true on the search request

var client = new ElasticClient();

var searchResponse = client.Search<Data>(s => s

Thanks for your help, I set TrackTotalHits to True, which reached my expectation

Thank you for your help. I have operated according to what you said and have solved this problem. Thank you again

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