Skip to content

Impossible to set index.mapping.nested_objects_limit and index.requests.cache.enable #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marcreichman opened this issue May 25, 2022 · 3 comments · Fixed by #344
Closed
Labels
Area: Specification Related to the API spec used to generate client code

Comments

@marcreichman
Copy link

Java API client version

7.17.4

Java version

17.0.3.1

Elasticsearch Version

7.17.0

Problem description

Attached is a mapping JSON file which correctly creates an index using HLRC, and fails using the newer Java client. A unit test class is provided to show what works and what does not, with both clients.

The json file (fails_with_new_client.json) gives an example of an ES mapping and settings that can be read directly by the old high level client to create an index, but when we attempt to use the new client, we get unknown field exceptions.

co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.indices.IndexSettings: Unknown field 'index.mapping.nested_objects.limit' (JSON path: ['index.mapping.nested_objects.limit']) (line no=1, column no=38, offset=37)

and

co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.indices.IndexSettings: Unknown field 'requests' (JSON path: index.requests) (line no=1, column no=22, offset=21)

We provide unit tests demonstrating this failure and also showing that these fields cannot be used to create IndexSettings.

We've managed to get the desired functionality by separating out the mapping from the settings, and using separate builders to set what's possible, and then finally, once the index is created, using a low level rest call to set the remaining settings. This is, as you might expect, not satisfactory. These workarounds keep us from moving to the new client in production.

Having the HLRC be deprecated while the new client misses functionality seems like a peculiar decision
ESUnknownFieldExceptionTests.zip
.

@swallez swallez added the Area: Specification Related to the API spec used to generate client code label Jun 23, 2022
@swallez
Copy link
Member

swallez commented Jun 23, 2022

Thanks for the very detailed report. This is an issue in the API specification used to produce the Java code: mappings should be mapping.

The fix will be included in the next 8.x and 7.17.x releases.

@KnowledgeGarden
Copy link

Timing on next release?

swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
@j0u13
Copy link

j0u13 commented Jul 27, 2022

Hi,
Being stuck by this issue in the migration of our project to the latest ES version I recently updated to 8.3.2 but I'm still facing this issue of the Java API serialising the settings with 'mappings' instead of 'mapping'. Is there somethings I missed or has the merge not fully worked for this issue?
The setting we're trying to use unsuccessfully is index.mapping.total_fields.limit.
The system still complains about mappings that should be mapping...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Specification Related to the API spec used to generate client code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants