elasticsearch 使用弹性8.5.1的RestHighLevelClient参数[包含类型名称]

bfrts1fy  于 2022-11-28  发布在  ElasticSearch
关注(0)|答案(1)|浏览(1252)

我尝试通过guide在与弹性8.5.1的兼容模式下运行带有RestHighLevelClient7.17.4的Sping Boot 应用程序。当应用程序尝试调用get时,我收到以下错误:Elasticsearch exception [type=illegal_argument_exception, reason=request [/*] contains unrecognized parameter: [include_type_name]]
我在兼容模式下的RestHighLevelClient配置:

@Value("${hs360.services.watchlist.mgmt.elasticsearch.host}")
private String elsHost;

@Value("${hs360.services.watchlist.mgmt.elasticsearch.port}")
private int elsRestPort;

@Bean(destroyMethod = "close")
public RestHighLevelClient sourceClient() {
    return new RestHighLevelClientBuilder(
            RestClient.builder(new HttpHost(elsHost, elsRestPort)).setRequestConfigCallback(r -> r.setConnectTimeout(60000).setSocketTimeout(90000)).build()
    ).setApiCompatibilityMode(true).build();
}

和代码段,当应用程序尝试调用get:

GetIndexResponse indexResponse = restHighLevelClient.indices().get(new GetIndexRequest().indices("*"), RequestOptions.DEFAULT);

从请求日志中我可以明显地看到,该请求包含参数include_type_name

org.elasticsearch.client.RestClient      : request [GET http://hs360-ss-s
ource-master:9200/*?master_timeout=30s&include_type_name=true&ignore_unavailable=false&expand_wildcards=open&all
ow_no_indices=true&ignore_throttled=false] returned 1 warnings: [299 Elasticsearch-8.5.1-c1310c45fc534583afe2c1c
03046491efba2bba2 "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consi
der cold or frozen tiers in place of frozen indices."]

我知道,这个参数是不赞成的,我虽然兼容性模块将处理这个,但显然,还有别的东西。我试图寻找解决方案,当我可以从请求中删除参数,但没有成功。
如何从请求中删除该参数或解决此问题?

33qvvth1

33qvvth11#

您需要升级到支持ES 8.5的Sping Boot 3.0,或者将Elastic降级到您的Spring Boot版本所支持的任何版本

相关问题