diff --git a/docs/changelog/96221.yaml b/docs/changelog/96221.yaml new file mode 100644 index 0000000000000..8df71102071de --- /dev/null +++ b/docs/changelog/96221.yaml @@ -0,0 +1,5 @@ +pr: 96221 +summary: Call listener in order to prevent the request from hanging +area: Transform +type: bug +issues: [] diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUpdateIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUpdateIT.java index 3ea469c405957..b554fe3173b79 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUpdateIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformUpdateIT.java @@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; public class TransformUpdateIT extends TransformRestTestCase { @@ -148,6 +149,24 @@ public void testUpdateTransferRightsSecondaryAuthHeaders() throws Exception { updateTransferRightsTester(true); } + public void testUpdateThatChangesSettingsButNotHeaders() throws Exception { + String transformId = "test_update_that_changes_settings"; + String destIndex = transformId + "-dest"; + + // Create the transform + createPivotReviewsTransform(transformId, destIndex, null, null, null); + + Request updateTransformRequest = createRequestWithAuth("POST", getTransformEndpoint() + transformId + "/_update", null); + updateTransformRequest.setJsonEntity(""" + { "settings": { "max_page_search_size": 123 } }"""); + + // Update the transform's settings + Map updatedConfig = entityAsMap(client().performRequest(updateTransformRequest)); + + // Verify that the settings got updated + assertThat(updatedConfig.get("settings"), is(equalTo(Map.of("max_page_search_size", 123)))); + } + private void updateTransferRightsTester(boolean useSecondaryAuthHeaders) throws Exception { String transformId = "transform1"; // Note: Due to a bug the transform does not fail to start after deleting the user and role, therefore invalidating diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java index adb073d888699..47464ba5e8389 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java @@ -205,6 +205,8 @@ protected void doExecute(Task task, Request request, ActionListener li authState, ActionListener.wrap(aVoid -> listener.onResponse(new Response(updatedConfig)), listener::onFailure) ); + } else { + listener.onResponse(new Response(updatedConfig)); } } else { listener.onResponse(new Response(updatedConfig));