Skip to content

Conversation

@weizijun
Copy link
Contributor

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.

repreduced:
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<>());

@elasticsearchmachine elasticsearchmachine added v8.0.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Aug 30, 2021
@weizijun
Copy link
Contributor Author

weizijun commented Aug 30, 2021

hi, @dakrone, @martijnvg , can you help to review this PR?

@dakrone dakrone added the :Data Management/Indices APIs APIs to create and manage indices and templates label Sep 1, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Sep 1, 2021
@dakrone dakrone self-requested a review September 1, 2021 23:18
@elasticmachine
Copy link
Collaborator

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

@dakrone
Copy link
Member

dakrone commented Sep 2, 2021

@elasticmachine ok to test

@dakrone
Copy link
Member

dakrone commented Sep 2, 2021

@elasticmachine update branch

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dakrone
Copy link
Member

dakrone commented Sep 3, 2021

@elasticmachine update branch

@dakrone dakrone added the v7.16.0 label Sep 3, 2021
@dakrone dakrone merged commit e321fb0 into elastic:master Sep 3, 2021
@dakrone
Copy link
Member

dakrone commented Sep 3, 2021

Thanks for fixing this @weizijun! I'll backport this to 7.x.

dakrone pushed a commit to dakrone/elasticsearch that referenced this pull request Sep 3, 2021
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 <[email protected]>
# Conflicts:
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
wjp719 added a commit to wjp719/elasticsearch that referenced this pull request Sep 4, 2021
* master: (128 commits)
  Mute DieWithDignityIT (elastic#77283)
  Fix randomization in MlNodeShutdownIT (elastic#77281)
  Add target_node_name for REPLACE shutdown type (elastic#77151)
  [DOCS] Adds information about version compatibility headers (elastic#77096)
  Fix template equals when mappings are wrapped (elastic#77008)
  Fix TextFieldMapper Retaining a Reference to its Builder (elastic#77251)
  Move die with dignity to be a test module (elastic#77136)
  Update task names for rest compatiblity (elastic#75267)
  [ML] adjusting bwc serialization for elastic#77256 (elastic#77257)
  Move `index.hidden` from Static to Dynamic settings (elastic#77218)
  Handle cgroups v2 in `OsProbe` (elastic#77128)
  Choose postings format from FieldMapper instead of MappedFieldType (elastic#77234)
  Add segment sorter for data streams (elastic#75195)
  Update skip after backport (elastic#77212)
  [ML] adding new defer_definition_decompression parameter to put trained model API (elastic#77189)
  [ML] Fix bug in inference stats persister for when feature reset is called
  Only check replicas in cancelling existing recoveries. (elastic#60564)
  Format `AbstractFilteringTestCase` (elastic#77217)
  [DOCS] Fixes line breaks. (elastic#77248)
  Convert 'routing' values in REST API tests to strings
  ...

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
elasticsearchmachine pushed a commit that referenced this pull request Sep 7, 2021
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 <[email protected]>
# Conflicts:
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java

Co-authored-by: weizijun <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Indices APIs APIs to create and manage indices and templates external-contributor Pull request authored by a developer outside the Elasticsearch team >non-issue Team:Data Management Meta label for data/management team v7.16.0 v8.0.0-alpha2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants