Skip to content

[7.x] Fix template equals when mappings are wrapped (#77008)#77275

Merged
elasticsearchmachine merged 3 commits intoelastic:7.xfrom
dakrone:backport/7.x/pr-77008
Sep 7, 2021
Merged

[7.x] Fix template equals when mappings are wrapped (#77008)#77275
elasticsearchmachine merged 3 commits intoelastic:7.xfrom
dakrone:backport/7.x/pr-77008

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone dakrone commented Sep 3, 2021

Backports the following commits to 7.x:

When create template v2. mappings will add _doc. This will cause the created template to be inconsistent with the queried template.

In template class, add mappingsEquals method, to deal with this case.

reproduced:
MetadataIndexTemplateServiceTests.testAddComponentTemplate
when mappings are not null, the case will failed.

```
        Template template = new Template(
            Settings.builder().build(),
            new CompressedXContent("{\"properties\":{\"@timestamp\":{\"type\":\"date\"}}}"),
            ComponentTemplateTests.randomAliases()
        );
        ComponentTemplate componentTemplate = new ComponentTemplate(template, 1L, new HashMap<>());
```

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
@dakrone dakrone added backport :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) v7.16.0 labels Sep 3, 2021
@elasticmachine elasticmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label Sep 3, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Sep 3, 2021

@elasticmachine update branch

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Sep 7, 2021

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit 17bf459 into elastic:7.x Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. Team:Data Management (obsolete) DO NOT USE. This team no longer exists. v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants