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

Add ComponentTemplate to MetaData #53290

Merged
merged 6 commits into from
Mar 12, 2020

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Mar 9, 2020

This adds a ComponentTemplate datastructure that will be used as part of #53101 (Index Templates
v2) to the MetaData class. Currently there are no APIs for interacting with this class, so it will
always be an empty map (other than in tests). This infrastructure will be built upon to add APIs in
a subsequent commit.

A ComponentTemplate is made up of a Template, a version, and an arbitrary metadata map. The
Template contains similar information to an IndexTemplateMetaData object— settings, mappings,
and alias configuration.

This adds a `ComponentTemplate` datastructure that will be used as part of elastic#53101 (Index Templates
v2) to the `MetaData` class. Currently there are no APIs for interacting with this class, so it will
always be an empty map (other than in tests). This infrastructure will be built upon to add APIs in
a subsequent commit.

A `ComponentTemplate` is made up of a `Template`, a version, and an arbitrary metadata map. The
`Template` contains similar information to an `IndexTemplateMetaData` object— settings, mappings,
and alias configuration.
@dakrone dakrone added :Data Management/Indices APIs APIs to create and manage indices and templates v8.0.0 v7.7.0 labels Mar 9, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@dakrone
Copy link
Member Author

dakrone commented Mar 9, 2020

This PR does not yet contain the APIs for put/get/deleting the component templates, however, it is already large enough and I wanted to split the work up to make it easier to review. I plan on working on the APIs immediately after this.

@martijnvg martijnvg mentioned this pull request Mar 9, 2020
39 tasks
Copy link
Contributor

@probakowski probakowski left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I've left few small comments

Map<String, Object> uncompressedMapping =
XContentHelper.convertToMap(new BytesArray(this.mappings.uncompressed()), true, XContentType.JSON).v2();
if (uncompressedMapping.size() > 0) {
builder.field(MAPPINGS.getPreferredName());
Copy link
Contributor

Choose a reason for hiding this comment

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

If we have empty settings or mappings section we still have corresponding field but we skip it in case of mappings, any reason for that?

Copy link
Member Author

Choose a reason for hiding this comment

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

No specific reason, this was copied to mimic the existing behavior of for index templates

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Thanks @dakrone! I left two comments.

@dakrone dakrone requested a review from martijnvg March 11, 2020 18:32
@dakrone
Copy link
Member Author

dakrone commented Mar 11, 2020

@elasticmachine update branch

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Left one small comment. LGTM otherwise.

@dakrone
Copy link
Member Author

dakrone commented Mar 12, 2020

@elasticmachine update branch

@dakrone dakrone merged commit ae55e06 into elastic:master Mar 12, 2020
@dakrone dakrone deleted the itv2-component-templates branch March 12, 2020 15:27
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Mar 12, 2020
* Add ComponentTemplate to MetaData

This adds a `ComponentTemplate` datastructure that will be used as part of elastic#53101 (Index Templates
v2) to the `MetaData` class. Currently there are no APIs for interacting with this class, so it will
always be an empty map (other than in tests). This infrastructure will be built upon to add APIs in
a subsequent commit.

A `ComponentTemplate` is made up of a `Template`, a version, and a MetaData.Custom class. The
`Template` contains similar information to an `IndexTemplateMetaData` object— settings, mappings,
and alias configuration.
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Mar 12, 2020
This disables the BWC tests for the ComponentTemplateMetadata class added in elastic#53290 and elastic#53489
dakrone added a commit that referenced this pull request Mar 12, 2020
This disables the BWC tests for the ComponentTemplateMetadata class added in #53290 and #53489
dakrone added a commit that referenced this pull request Mar 12, 2020
* Add ComponentTemplate to MetaData (#53290)

* Add ComponentTemplate to MetaData

This adds a `ComponentTemplate` datastructure that will be used as part of #53101 (Index Templates
v2) to the `MetaData` class. Currently there are no APIs for interacting with this class, so it will
always be an empty map (other than in tests). This infrastructure will be built upon to add APIs in
a subsequent commit.

A `ComponentTemplate` is made up of a `Template`, a version, and a MetaData.Custom class. The
`Template` contains similar information to an `IndexTemplateMetaData` object— settings, mappings,
and alias configuration.

* Update minimal supported version constant

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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 v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants