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

Issue with Elasticsearch Alias Removal and Addition #1681

Open
younuscodes opened this issue Jan 29, 2024 · 0 comments
Open

Issue with Elasticsearch Alias Removal and Addition #1681

younuscodes opened this issue Jan 29, 2024 · 0 comments

Comments

@younuscodes
Copy link

Which version of Elastic are you using?

[x] elastic.v6 (for Elasticsearch 6.2.4)

Please describe the expected behavior

The removeAliasIndex function should consistently return accurate acknowledgment status (res.Acknowledged = true) when successfully removing an alias. This behavior is crucial for ensuring reliable subsequent operations, such as adding a new index to the alias.

Please describe the actual behavior

The removeAliasIndex function sometimes returns res.Acknowledged = false even when the alias removal is successful. This intermittent behavior poses challenges when attempting to add a new index to the alias, as the acknowledgment status does not accurately reflect the success of the removal operation. Additionally, there are instances where the call returns res.Acknowledged == false, but the index is deleted after some time.

Any steps to reproduce the behavior?

The issue seems to occur intermittently, making it challenging to provide specific steps to reproduce. The problem is observed in a production environment.
Additional Information

Elasticsearch version: 6.2.4

Note

Any insights or recommendations on resolving this issue would be greatly appreciated. Please consider the Elasticsearch version mentioned and provide guidance accordingly. Thank you!

code:
// Function to remove alias index
func removeAliasIndex(isHttps bool, host, indexName, aliasName string) error {
// ... (existing code)

res, err := esClient.Alias().Remove(indexName, aliasName).Do(context.Background()) // some time this call returns res.Acknowledged == false but actually it delete index after some time
if err != nil {
    return err
}

// ... (existing code)

}

// Function to add alias index
func addAliasIndex(isHttps bool, host, indexName, aliasName string) error {
// ... (existing code)

res, err := esClient.Alias().Add(indexName, aliasName).Do(context.Background())
if err != nil {
    return err
}

// ... (existing code)

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant