设置 index.max_result_window 的值

set the value of index.max_result_window

正如标题所说,如何在我的 spring 数据弹性搜索应用程序(spring 启动)中设置它?

我可以在异常跟踪中看到它设置为 10000。我需要更多。

如果您想增加 max_result_window,您应该在创建索引时设置此 属性。 使用 spring 启动,你可以有这样的东西(max_result_window = 15000 的例子:

@SpringBootApplication
public class MainClass implements CommandLineRunner {

    @Autowired
    public ElasticsearchTemplate elasticsearchTemplate;

    public static void main(String[] args) {
        SpringApplication.run(MainClass.class).close()
    }

    @Override
    public void run(String... args) throws Exception {
        elasticsearchTemplate.createIndex(Entity.class, "max_result_window = 15000");
}

只是您 application.properties 中的一个条目:

spring.data.elasticsearch.properties.index.max_result_window=15000