0

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?

Tomas
  • 35
  • 5

1 Answers1

0

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

Val
  • 207,596
  • 13
  • 358
  • 360
  • thanks for the answer, we are not using Spring Data Elastic in any way. Configuration is completely different in doc you have posted. We used this [guide](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/7.17/installation.html) – Tomas Nov 27 '22 at 12:35
  • Then you need to use the version 8.5.1 of the RestHighLevelClient – Val Nov 27 '22 at 21:11
  • Thats the problem, we have to use old api for now. In new version, there are some unsuported features which we need. Thats why we are using compatibility mod. – Tomas Nov 28 '22 at 09:25