Skip to content

Commit 22dd667

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 07f65d9 commit 22dd667

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
@@ -138,7 +138,7 @@ protected void doStart(ClusterState clusterState) {
138138
throw blockException;
139139
}
140140
}
141-
request.concreteIndex(indexNameExpressionResolver.concreteSingleIndex(clusterState, request).getName());
141+
request.concreteIndex(indexNameExpressionResolver.concreteWriteIndex(clusterState, request).getName());
142142
resolveRequest(clusterState, request);
143143
blockException = checkRequestBlock(clusterState, request);
144144
if (blockException != null) {

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

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

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

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

0 commit comments

Comments
 (0)