org.elasticsearch.client.ResponseException while creating index

I am trying to create index with High Rest Client, version 7.17.10
String mappingSource = "{"mappings":{"properties":{"name":{"type":"text"},"age":{"type":"integer"}}}}";
CreateIndexRequest request = new CreateIndexRequest("user-test-demo");
request.source(mappingSource, XContentType.JSON);
CreateIndexResponse createIndexResponse = elasticsearchClient.indices().create(request, RequestOptions.DEFAULT);

The exception I am receiving:
Elasticsearch exception [type=illegal_argument_exception, reason=request [/user-test-demo] contains unrecognized parameter: [include_type_name]]

org.elasticsearch.client.ResponseException: method [PUT], host [http://localhost:9200], URI [/user-test-demo?master_timeout=30s&include_type_name=true&timeout=30s], status line [HTTP/1.1 400 Bad Request]

Any help would be greatly appreciated.

What is the version of the server and the version of the client?

BTW, you should use the latest Java client instead.

The Elasticsearch server version I am using is 8.7.0 and the Elasticsearch REST High-Level Client version is 7.17.0.

So switch to the new client and use the same version for both client and server.

May I know, which is the stable version?

8.7.2 I believe.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.