elastic/elasticsearch

Response of GET index_templates is missing requiered field composed_of

fabian-froehlich opened this issue · 2 comments

Elasticsearch Version

8.12.0

Installed Plugins

No response

Java Version

bundled

OS Version

bundled

Problem Description

The field composed_of is missing in the newest version of elasticsearch when calling GET /_index_template/ API
This results in MissingRequiredPropertyException in the new Elasticsearch Java-Client as the field is not annotated with @Nullable

Elasticsearch 8.11.4

{
    "index_templates": [{
            "name": "mytemplate",
            "index_template": {
                "index_patterns": ["pattern_*"],
                "template": {
                    "settings": {
                        "index": {
                            "number_of_shards": "1",
                            "number_of_replicas": "1",
                            "refresh_interval": "1s"
                        }
                    },
                    "mappings": {
                        "dynamic": false
                    }
                },
                "composed_of": [],
                "priority": 0
            }
        }
    ]
}

Elasticsearch 8.12.0

{
    "index_templates": [{
            "name": "mytemplate",
            "index_template": {
                "index_patterns": ["pattern_*"],
                "template": {
                    "settings": {
                        "index": {
                            "number_of_shards": "1",
                            "number_of_replicas": "1",
                            "refresh_interval": "1s"
                        }
                    },
                    "mappings": {
                        "dynamic": false
                    }
                },
                "priority": 0
            }
        }
    ]
}

Steps to Reproduce

Request GET /_index_template/ API with the 8.11.4 versus 8.12.0 Version

Logs (if relevant)

No response

Pinging @elastic/es-data-management (Team:Data Management)

Okay, I bisected this and discovered that it was introduced in e786cfa, specifically these lines: e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630

For options, we can either re-add the missing functionality, or define the composed_of field as optional (it has always been optional from the perspective of the interval ES code, it just so happens that we used to always show it).