gpt4 book ai didi

spring-boot - 查询第二页10000 elasticsearchresttemplate

转载 作者:行者123 更新时间:2023-12-03 02:19:19 29 4
gpt4 key购买 nike

这是我的下面的代码

   private ElasticsearchRestTemplate template;       

int elasticSearchMaxSize = 10000;

SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withPageable(PageRequest.of(1, elasticSearchMaxSize/*, Sort.Direction.ASC, "meta.time_created"*/))
.build();
Page<myData> page = this.template.queryForPage(searchQuery, myData.class);
我无法查询Elasticsearch的第二页,最大值为10,000。
错误是
Result window is too large, from + size must be less than or equal to: [10000] but was [20000]
我要查询第二页,一次有10,000条记录。我怎样才能做到这一点?

最佳答案

转到Kibana中的Dev Tools并运行以下查询:

PUT your_index_name/_settings
{
"max_result_window" : 500000
}
它应该给你:
{
"acknowledged": true
}
运行您的代码,它现在应该可以工作!

关于spring-boot - 查询第二页10000 elasticsearchresttemplate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62809040/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com