Allow _update on write alias (#45318)

Using the document update API on aliases with a write index does not work.

Follow-up to #31520
This commit is contained in:
Yannick Welsch 2019-08-09 09:01:15 +02:00
parent 7d0aff0ed5
commit 5ddeb488a6
2 changed files with 3 additions and 2 deletions

View File

@ -143,7 +143,7 @@ public abstract class TransportInstanceSingleOperationAction<
throw blockException;
}
}
request.concreteIndex(indexNameExpressionResolver.concreteSingleIndex(clusterState, request).getName());
request.concreteIndex(indexNameExpressionResolver.concreteWriteIndex(clusterState, request).getName());
resolveRequest(clusterState, request);
blockException = checkRequestBlock(clusterState, request);
if (blockException != null) {

View File

@ -292,7 +292,8 @@ public class UpdateIT extends ESIntegTestCase {
}
public void testUpdate() throws Exception {
createTestIndex();
assertAcked(prepareCreate("test").addAlias(new Alias("alias").writeIndex(true)));
assertAcked(prepareCreate("test2").addAlias(new Alias("alias")));
ensureGreen();
Script fieldIncScript = new Script(ScriptType.INLINE, UPDATE_SCRIPTS, FIELD_INC_SCRIPT, Collections.singletonMap("field", "field"));