elasticsearch-java
elasticsearch-java copied to clipboard
Unexpected JSON event 'VALUE_FALSE' from get component template endpoint when mapping includes "subobjects": false
Java API client version
8.19.3
Java version
17
Elasticsearch Version
8.19.3
Problem description
Getting an error when attempting to retrieve component templates from elasticsearch where the component template includes a "subobjects": false mapping. Error is:
Error deserializing co.elastic.clients.elasticsearch._types.mapping.ObjectProperty: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_FALSE' instead of '[KEY_NAME, VALUE_STRING]' (JSON path: component_templates[0].component_template.template.mappings.properties.doc.subobjects)
This seems to be the same issue for subobjects as previously occurred for Refresh and DynamicMapping (see: https://github.com/elastic/elasticsearch-java/issues/139 and https://github.com/elastic/elasticsearch-java/pull/275).
To reproduce:
String templates = """
{
"component_templates": [
{
"name": "test-template",
"component_template": {
"template": {
"mappings": {
"properties": {
"document": {
"subobjects": false,
"properties": {
"body.size": {
"type": "integer"
}
}
}
}
}
}
}
}
]
}
"""
new GetComponentTemplateResponse.Builder().withJson(new StringReader(templates));