Skip to content

Commit 371eabb

Browse files
committed
Allow _update on write alias (#45318)
Using the document update API on aliases with a write index does not work. Follow-up to #31520
1 parent 540af6b commit 371eabb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

server/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected void doStart(ClusterState clusterState) {
143143
throw blockException;
144144
}
145145
}
146-
request.concreteIndex(indexNameExpressionResolver.concreteSingleIndex(clusterState, request).getName());
146+
request.concreteIndex(indexNameExpressionResolver.concreteWriteIndex(clusterState, request).getName());
147147
resolveRequest(clusterState, request);
148148
blockException = checkRequestBlock(clusterState, request);
149149
if (blockException != null) {

server/src/test/java/org/elasticsearch/update/UpdateIT.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ public void testIndexAutoCreation() throws Exception {
292292
}
293293

294294
public void testUpdate() throws Exception {
295-
createTestIndex();
295+
assertAcked(prepareCreate("test").addAlias(new Alias("alias").writeIndex(true)));
296+
assertAcked(prepareCreate("test2").addAlias(new Alias("alias")));
296297
ensureGreen();
297298

298299
Script fieldIncScript = new Script(ScriptType.INLINE, UPDATE_SCRIPTS, FIELD_INC_SCRIPT, Collections.singletonMap("field", "field"));

0 commit comments

Comments
 (0)