-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
In the Alias of data streams filter on only one data_stream ends up applying to all others #92050
Comments
I looked into this a little bit. Here's a quick reproduction that includes creating the data streams from POST /logs-foo-bar/_doc
{
"@timestamp": "2022-01-01"
}
POST /logs-foo-baz/_doc
{
"@timestamp": "2022-01-01"
}
POST _aliases
{
"actions": [
{
"add": {
"index": "logs-foo-bar",
"alias": "alias_2",
"filter": {
"bool": {
"filter": [
{
"term": {
"reaction": "report"
}
}
]
}
}
}
},
{
"add": {
"index": "logs-foo-baz",
"alias": "alias_2"
}
}
]
}
GET /_alias/alias_2 The output includes the filter duplicated for both data streams, instead of only for the Looking into where this is happening in the code, this is due to a couple of blocks of code: This first is: elasticsearch/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAlias.java Lines 160 to 172 in c43571b
Where the issue is the The second part is this function: elasticsearch/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamMetadata.java Lines 102 to 126 in c43571b
Where the data stream aliases are being stored in an |
Pinging @elastic/es-data-management (Team:Data Management) |
Index aliases allow each index in the alias to have a different filter. Data stream aliases appear to do this, but in reality they do not. That is, if you ask to add two data streams to a data stream alias, each with a different filter, the API allows it but only keeps one of the filters. This PR makes it so that the DataStreamAlias keeps a map of DataStreams to filters so that the different filters are respected. Closes #92050
Elasticsearch Version
8.5
Installed Plugins
No response
Java Version
bundled
OS Version
any
Problem Description
The use of alias of data streams behaves differently from the alias of indices.
When trying to apply filter to only one data_stream in the Alias, the result is that It ends up applying to both.
Steps to Reproduce
Per the above request, I’m trying to apply filter to only one data stream in the Alias but the result is that It ends up applying to both.
result
Logs (if relevant)
No response
The text was updated successfully, but these errors were encountered: