Skip to content
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

Response of GET index_templates is missing requiered field composed_of #104627

Closed
fabian-froehlich opened this issue Jan 22, 2024 · 2 comments · Fixed by #105315
Closed

Response of GET index_templates is missing requiered field composed_of #104627

fabian-froehlich opened this issue Jan 22, 2024 · 2 comments · Fixed by #105315
Assignees
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team v8.12.0

Comments

@fabian-froehlich
Copy link

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

@fabian-froehlich fabian-froehlich added >bug needs:triage Requires assignment of a team area label labels Jan 22, 2024
@Mikep86 Mikep86 added :Data Management/Indices APIs APIs to create and manage indices and templates v8.12.0 Team:Data Management Meta label for data/management team and removed needs:triage Requires assignment of a team area label labels Jan 22, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@dakrone
Copy link
Member

dakrone commented Feb 8, 2024

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).

dakrone added a commit to dakrone/elasticsearch that referenced this issue Feb 8, 2024
Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
elastic@e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves elastic#104627
dakrone added a commit that referenced this issue Feb 15, 2024
* Always show `composed_of` field for composable index templates

Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves #104627
dakrone added a commit to dakrone/elasticsearch that referenced this issue Feb 15, 2024
…ic#105315)

* Always show `composed_of` field for composable index templates

Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
elastic@e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves elastic#104627
dakrone added a commit to dakrone/elasticsearch that referenced this issue Feb 15, 2024
…ic#105315)

* Always show `composed_of` field for composable index templates

Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
elastic@e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves elastic#104627
elasticsearchmachine pushed a commit that referenced this issue Feb 15, 2024
…) (#105571)

* Always show `composed_of` field for composable index templates

Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves #104627
elasticsearchmachine pushed a commit that referenced this issue Feb 15, 2024
…) (#105572)

* Always show `composed_of` field for composable index templates

Prior to e786cfa we inadvertently always added composable index
templates with `composed_of: []` beacuse
e786cfa#diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

https://github.com/elastic/elasticsearch/blob/89e714ee5dc60db8b4979ab6372ff767e108e9da/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java#L172-L177

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves #104627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team v8.12.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants