-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Create data stream aliases from template #73867
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 |
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 @danhermann, I think this pr is in the right direction, but I think we maybe can simplify even more (see 2 comments).
@@ -51,8 +52,11 @@ | |||
@Nullable | |||
private final Boolean isHidden; | |||
|
|||
@Nullable | |||
private final Boolean isDataStream; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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