Create index with index-settings

We are trying to migrate from Elasticsearch 6.7.1 to Elasticsearch 8.2.0.
In Elasticsearch 6.7.1 it was possible to provide index-settings within an CreateIndexRequest as follows

{
    "index": {
      "mapping": {
        "total_fields": {
          "limit": 4000
        }
      }
    }
}

In Elasticsearch 8.2.0 it produces the following error

Exception in thread "main" co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.indices.IndexSettings: Unknown field 'mapping' (JSON path: index.mapping) (line no=3, column no=16, offset=34)
	at co.elastic.clients.json.ObjectDeserializer.parseUnknownField(ObjectDeserializer.java:221)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:178)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:136)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
	at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
	at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:71)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
	at co.elastic.clients.util.WithJsonObjectBuilderBase.withJson(WithJsonObjectBuilderBase.java:66)
	at co.elastic.clients.json.WithJson.withJson(WithJson.java:57)

As workaround i tried to set the index.mapping.total_fields.limit via the JAVA API Client via

builder.mappings(  m -> m.totalFields( totalFields -> totalFields.limit( 4000 ) ));

but it also produces an error

co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/indices.create] failed: [illegal_argument_exception] unknown setting [index.mappings.total_fields.limit] did you mean any of [index.mapping.total_fields.limit, index.mapping.nested_fields.limit, index.mapping.dimension_fields.limit]?
	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:281) ~[elasticsearch-java-8.2.0.jar:?]
	at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:147) ~[elasticsearch-java-8.2.0.jar:?]
	at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.create(ElasticsearchIndicesClient.java:266) ~[elasticsearch-java-8.2.0.jar:?]

So how can i set value of index.mapping.total_fields.limit within an CreateIndexRequest?

2 Likes

Elasticsearch 6.7.1 is EOL and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

1 Like

Hi Alexander! It is happening to me also. It seems clearly to be a bug

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