Fix ES index upgrades when using index aliases #3863
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ES supports fetching the index config for multiple indices in a single request. We don’t make use of this, but for this reason the ES responses are an object with a key for each requested index. For example:
In case an index is requested using an alias, the key will be the original index name and not the alias, i.e. we cannot rely on the key being the name that was used to request the index, as this would fail in case aliases are used.
However, as we’re always requesting only a single index at a time, the response should always contain data for one index, so we can extract that without relying on the name of the index.
You can test the following scenarios:
curl -X "DELETE" "http://localhost:9200/aleph-entity-company-v1"
aleph upgrade
.aleph upgrade
.