Skip to content
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

The get aliases api should not return entries for data streams with no aliases #72953

Merged

Conversation

martijnvg
Copy link
Member

@martijnvg martijnvg commented May 11, 2021

The get alias api should take into account the aliases parameter when
returning aliases that refer to data streams and don't return entries
for data streams that don't have any aliases pointing to it.

Relates to #66163

The get alias api should take into account the aliases parameter when
returning aliases that refer to data streams.

Relates to elastic#66163
@martijnvg martijnvg requested a review from danhermann May 11, 2021 18:43
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label May 11, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

Copy link
Contributor

@danhermann danhermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this PR is intended to address this, but when testing this API, GET _alias returns data stream aliases but if GET _alias/dataStreamAlias is attempted, a 404 is returned.

@martijnvg
Copy link
Member Author

I don't know if this PR is intended to address this, but when testing this API, GET _alias returns data stream aliases but if GET _alias/dataStreamAlias is attempted, a 404 is returned.

I completely missed that. This is a different bug in RestGetAliasesAction#buildRestResponse(...) method.
In order to fix that, I think this method needs to add the data stream alias names to the returnedAliasNames variable.
Do you want this to be fixed in this PR or another PR?

This PR avoids returning entries for data streams that don't match with the provided alias name.
For example without this change, in a cluster with 2 data streams and an alias with name logs then executing GET /_alias/wrong-name returns:

{
    "error": "alias [wrong_name] missing",
    "status": 404,
    "ilm-history-5": {
        "aliases": {}
    },
    "logs-bar-baz": {
        "aliases": {}
    },
    "logs-foo-bar": {
        "aliases": {}
    }
}

While the following is expected:

{
    "error": "alias [wrong_name] missing",
    "status": 404
}

(at least this matches the behaviour with aliases pointing to indices)

@danhermann
Copy link
Contributor

Do you want this to be fixed in this PR or another PR?

Another PR is fine. I was just testing it in an attempt to understand what this PR did. Thanks for the explanation.

@martijnvg martijnvg requested a review from danhermann May 17, 2021 07:29
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request May 17, 2021
Change the get alias api to not return a 404 when filtering
by alias name that refers to data streams.

Originated from elastic#72953
Relates to elastic#66163
martijnvg added a commit that referenced this pull request May 18, 2021
Change the get alias api to not return a 404 when filtering
by alias name that refers to data streams.

Originated from #72953
Relates to #66163
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request May 18, 2021
Backport elastic#73140 to 7.x branch.

Change the get alias api to not return a 404 when filtering
by alias name that refers to data streams.

Originated from elastic#72953
Relates to elastic#66163
martijnvg added a commit that referenced this pull request May 18, 2021
Backport #73140 to 7.x branch.

Change the get alias api to not return a 404 when filtering
by alias name that refers to data streams.

Originated from #72953
Relates to #66163
@martijnvg martijnvg changed the title Adjust get aliases api for aliases that point to data streams The get aliases api should return entries for data streams with no aliases May 19, 2021
@martijnvg martijnvg changed the title The get aliases api should return entries for data streams with no aliases The get aliases api should not return entries for data streams with no aliases May 19, 2021
@martijnvg martijnvg merged commit 4b2c3ab into elastic:master May 19, 2021
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request May 19, 2021
…o aliases

Backport elastic#72953 to 7.x branch.

The get alias api should take into account the aliases parameter when
returning aliases that refer to data streams and don't return entries
for data streams that don't have any aliases pointing to it.

Relates to elastic#66163
martijnvg added a commit that referenced this pull request May 19, 2021
…o aliases (#73225)

Backport #72953 to 7.x branch.

The get alias api should take into account the aliases parameter when
returning aliases that refer to data streams and don't return entries
for data streams that don't have any aliases pointing to it.

Relates to #66163
FrankHassanabad added a commit to elastic/kibana that referenced this pull request Jun 9, 2021
## Summary

Unskips signal migration tests now that elastic search is fixed get alias bug

ES ticket about get alias bug:
elastic/elasticsearch#72953

Tickets related that should be fixed now:
#99915
#100305

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 9, 2021
)

## Summary

Unskips signal migration tests now that elastic search is fixed get alias bug

ES ticket about get alias bug:
elastic/elasticsearch#72953

Tickets related that should be fixed now:
elastic#99915
elastic#100305

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
kibanamachine added a commit to elastic/kibana that referenced this pull request Jun 9, 2021
…101831)

## Summary

Unskips signal migration tests now that elastic search is fixed get alias bug

ES ticket about get alias bug:
elastic/elasticsearch#72953

Tickets related that should be fixed now:
#99915
#100305

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

Co-authored-by: Frank Hassanabad <[email protected]>
semd pushed a commit to elastic/kibana that referenced this pull request Jun 10, 2021
## Summary

Unskips signal migration tests now that elastic search is fixed get alias bug

ES ticket about get alias bug:
elastic/elasticsearch#72953

Tickets related that should be fixed now:
#99915
#100305

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Data streams Data streams and their lifecycles >non-issue Team:Data Management Meta label for data/management team v7.14.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants