RestHighLevelClient parameter [include_type_name] with Elastic 8.5.1

489 Views Asked by At

iam trying to run spring boot application with RestHighLevelClient 7.17.4 in compatibility mod with elastic 8.5.1 by fallowing guide. When application try to call get, i've got the fallowing error: Elasticsearch exception [type=illegal_argument_exception, reason=request [/*] contains unrecognized parameter: [include_type_name]]

My configuration of RestHighLevelClient in compatibility mod:

@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();
}

and snippet, when application try to call get:

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

From log of request i can obviously see, that request contains parameter 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."]

I know, that this parameter is deprecated, i though compatibility mod would handle this, but obviously, there is something else. I tried to search for solution, when i can remove parameter from request, but without success.

How could i remove that parameter from request or work around this problem?

1

There are 1 best solutions below

3
Val On

You either need to upgrade to Spring Boot 3.0 which supports ES 8.5 or downgrade Elastic to whatever your Spring Boot version supports