-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Conversation
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.
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
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. |
There was a problem hiding this 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
server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplate.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplate.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplate.java
Show resolved
Hide resolved
Map<String, Object> uncompressedMapping = | ||
XContentHelper.convertToMap(new BytesArray(this.mappings.uncompressed()), true, XContentType.JSON).v2(); | ||
if (uncompressedMapping.size() > 0) { | ||
builder.field(MAPPINGS.getPreferredName()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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.
server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplate.java
Show resolved
Hide resolved
@elasticmachine update branch |
There was a problem hiding this 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.
server/src/main/java/org/elasticsearch/cluster/DiffableUtils.java
Outdated
Show resolved
Hide resolved
@elasticmachine update branch |
* 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.
This disables the BWC tests for the ComponentTemplateMetadata class added in elastic#53290 and elastic#53489
* 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 <[email protected]>
This adds a
ComponentTemplate
datastructure that will be used as part of #53101 (Index Templatesv2) to the
MetaData
class. Currently there are no APIs for interacting with this class, so it willalways 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 aTemplate
, a version, and an arbitrary metadata map. TheTemplate
contains similar information to anIndexTemplateMetaData
object— settings, mappings,and alias configuration.