0

I am trying to update the limit for number of results returned from elasticsearch in my java spring boot application

index.max_result_window: 15000

I have tried by doing

UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest("index");
updateSettingsRequest.settings(Settings.builder()
        .put("index.max_result_window", 15000)
);
elsRestClient.indices().putSettings(updateSettingsRequest, RequestOptions.DEFAULT);

But it does not work and the total results returned are still 10000. I haven't found the solution for this.

1 Answers1

0

I will suggest to not change the index.max_result_window as it have impact on performance. You can read more about this here.

You can use Search After functionality of elasticsearch to retrive more data from elastic. You can see java example here.

You can enabled track total hits in your query request so it will return number of total result found. You can check this documentation.

Sagar Patel
  • 4,993
  • 1
  • 8
  • 19
  • How can I make elasticsearch to return the actual totalHits value. I have synced more than 10000 items to elastic search. But the totalHits just 10000 – Hue Minh Nguyen Nov 21 '22 at 10:07
  • Elasticsearch limit 10k result by default. You can enabled `track_total_hits` with value `true` so it will return actual count when more then 10k documents are matching. For retriving more then 10k document you need to use search after or scroll API as changing `index.max_result_window` will impact performance. I hope this will help you to understand more clearly. – Sagar Patel Nov 21 '22 at 10:14