Create data stream aliases from template#73867
Conversation
|
@elasticmachine update branch |
|
@elasticmachine update branch |
|
@elasticmachine update branch |
|
@martijnvg, I have data stream aliases being created from templates in this PR. I did it using only the |
martijnvg
left a comment
There was a problem hiding this comment.
Thanks @danhermann, I think this pr is in the right direction, but I think we maybe can simplify even more (see 2 comments).
| private final Boolean isHidden; | ||
|
|
||
| @Nullable | ||
| private final Boolean isDataStream; |
There was a problem hiding this comment.
I don't think this field is needed? I also don't see that is currently is used in this pr.
In MetadataCreateDataStreamService, data stream aliases can be created without this information? The fact that a DataStreamTemplate is defined should be sufficient?
| private final boolean hidden; | ||
|
|
||
| @Nullable | ||
| private final Map<String, AliasMetadata> aliases; |
There was a problem hiding this comment.
I think we can reuse the alias definitions in ComposableIndexTemplate (defined inside the Template class)?
If a composable index template has a DataStreamTemplate and aliases definitions are present then data stream aliases are created. If just alias definitions are present in composable index template then indices aliases are created.
|
@elasticmachine run elasticsearch-ci/part-2 |
martijnvg
left a comment
There was a problem hiding this comment.
Left 2 small comments, LGTM otherwise 👍.
| Map<String, AliasMetadata> aliases = new HashMap<>(aliasCount); | ||
| for (int k = 0; k < aliasCount; k++) { | ||
| final String aliasName = randomAlphaOfLength(6); | ||
| aliases.put(aliasName, AliasMetadata.newAliasMetadataBuilder(aliasName).build()); |
There was a problem hiding this comment.
maybe also test the case here with aliases with write data streams and filter? (Either by randomly adding and asserting it or a new test)
| @@ -222,6 +221,13 @@ static ClusterState createDataStream(MetadataCreateIndexService metadataCreateIn | |||
| logger.info("adding data stream [{}] with write index [{}] and backing indices [{}]", dataStreamName, | |||
There was a problem hiding this comment.
maybe enhance this log line with the fact that aliases were created as well (if template has aliases)?
|
Thanks, @martijnvg. I made those changes. |
With #73867, you can use component and index templates to add data stream aliases.
…c#75688) With elastic#73867, you can use component and index templates to add data stream aliases.
…c#75688) With elastic#73867, you can use component and index templates to add data stream aliases.
Allows the creation of data stream aliases from a data stream template.
Relates to #66163