You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With #30942 (add is-write-index to aliases) and #31520, we allow an alias to point to multiple indices when
writing/deleting documents. This means that we will resolve the alias to the "write index" specified in alias metadata.
This presents a problem when requests resolve routing values against aliases. Historically, it was clear
that if an alias specified routing values, those would be used, instead of the index's. With, potentially, different aliases having different routing values, it isn't clear which routing value an index request should use.
public String resolveIndexRouting(@Nullable String routing, String aliasOrIndex) {
if (aliasOrIndex == null) {
return routing;
}
AliasOrIndex result = getAliasAndIndexLookup().get(aliasOrIndex);
if (result == null || result.isAlias() == false) {
return routing;
}
AliasOrIndex.Alias alias = (AliasOrIndex.Alias) result;
if (result.getIndices().size() > 1) {
rejectSingleIndexOperation(aliasOrIndex, result);
}
There are a few solutions
when resolving routing within write operations (ones that require a write index), aliases matching multiple indices can have their routing values ignored. This means the default routing value is used, and no exception is thrown.
We can throw an exception if an alias points to multiple indices and any one of the aliases specifies their own routing values. Otherwise, we have nothing to look for, so it is safe to have an alias point to multiple indices, and simply return the default routing value passed into the method.
If write index exists, resolve to routing of the alias from the AliasMetadata on that index. If no write index exists, throw exception. Effect of this is that if there if an alias with routing points to only one index (with no is_write_index set), the existing behavior is preserved.
With #30942 (add is-write-index to aliases) and #31520, we allow an alias to point to multiple indices when
writing/deleting documents. This means that we will resolve the alias to the "write index" specified in alias metadata.
This presents a problem when requests resolve routing values against aliases. Historically, it was clear
that if an alias specified routing values, those would be used, instead of the index's. With, potentially, different aliases having different routing values, it isn't clear which routing value an index request should use.
The code in Metadata that needs modifying:
https://github.com/elastic/elasticsearch/blob/4761a1f/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java#L479-L491
There are a few solutions
cc/ @bleskes
The text was updated successfully, but these errors were encountered: