elastic icon indicating copy to clipboard operation
elastic copied to clipboard

Issue with Elasticsearch Alias Removal and Addition

Open younuscodes opened this issue 1 year ago • 0 comments

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)

}

younuscodes avatar Jan 29 '24 23:01 younuscodes