Setting mapping limits using java api in 8.2 fails due to wrong config name creation

Hi, I'm currently using the new version of java api 8.2 with also ES 8.2 in a dockerized instance.

I'm creating indexes through the API and using IndexSettings to add custom setting. One of them is the total fields limit.

So I do:

      MappingLimitSettings.Builder mappings = new MappingLimitSettings.Builder();
      mappings.totalFields(new MappingLimitSettingsTotalFields.Builder().limit(5000).build());
      return new IndexSettings.Builder()
         .refreshInterval(new Time.Builder().time("-1").build())
         .numberOfReplicas("0")
         .mappings(mappings.build())
         .build();

But I get this error:

[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]?

The code is adding the config under mappings but it should be mapping (singular)

am I doing something wrong? or is this in fact a bug?

2 Likes

I'm seeing the same issue, still not fixed in the Java API client 8.2.2:

This

        IndexSettings settings = new IndexSettings.Builder()
                .mappings(m -> m.totalFields(totalFields -> totalFields.limit(2000)))
                .build();

Gets serialized as:

{"mappings":{"total_fields":{"limit":2000}}}

When sending a CreateIndexRequest with such an IndexSettings, request (rightfully) fails, with message:

[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]?

Is there any plan to fix this?

2 Likes

Same issue here.
I find no way to configure this setting properly using the java api.

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