Skip to content

[8.19] Bug fix: the filter of a data stream alias is not always properly removed. (#139679)#139691

Merged
elasticsearchmachine merged 1 commit intoelastic:8.19from
gmarouli:backport/8.19/pr-139679
Dec 17, 2025
Merged

[8.19] Bug fix: the filter of a data stream alias is not always properly removed. (#139679)#139691
elasticsearchmachine merged 1 commit intoelastic:8.19from
gmarouli:backport/8.19/pr-139679

Conversation

@gmarouli
Copy link
Contributor

Backports the following commits to 8.19:

…oved. (elastic#139679)

A data stream alias that has more than 1 data stream does not handle
correctly the removal of a filtered data stream alias. It currently
retains the filter even after the alias is removed.

```
# Create 2 data streams

PUT _data_stream/logs-yyy-default
PUT _data_stream/logs-xxx-default

# Add a filtered alias to one and a simple alias to the other.
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "logs-yyy-default",
        "alias": "myalias",
        "filter": {
          "term": {
            "type": "mytype"
          }
        }
      }
    },
    {
      "add": {
        "index": "logs-xxx-default",
        "alias": "myalias"
      }
    }
  ]
}

# Remove the filtered alias
POST _aliases
{
  "actions": [
    {
      "remove": {
        "index": "logs-yyy-default",
        "alias": "myalias"
      }
    }
  ]
}

# Add back the alias but WITHOUT filter
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "logs-yyy-default",
        "alias": "myalias"
       }
    }
  ]
}
```

The last alias will contain the initial filter while it should not. This
PR fixes that.

Furthermore, we edit the update and removal of data streams from an
alias to be able to handle orphaned aliases.
@gmarouli gmarouli added :StorageEngine/Data streams Data streams and their lifecycles >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Data Management (obsolete) DO NOT USE. This team no longer exists. labels Dec 17, 2025
@elasticsearchmachine elasticsearchmachine merged commit fd762ed into elastic:8.19 Dec 17, 2025
28 checks passed
@gmarouli gmarouli deleted the backport/8.19/pr-139679 branch December 17, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :StorageEngine/Data streams Data streams and their lifecycles Team:Data Management (obsolete) DO NOT USE. This team no longer exists. v8.19.10

2 participants