From a3bd6d1ad94837d8773046dabe8dafb0446f3202 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 8 Nov 2016 11:42:07 -0500 Subject: [PATCH] Switch reindex with slices error to IAE If you try to reindex with multiple slices against a node that doesn't support it we throw an `IllegalArgumentException` so `assertVersionSerializable` is ok with it and so if this happens in REST it comes back as a 400 error. --- .../index/reindex/AbstractBulkByScrollRequest.java | 2 +- .../org/elasticsearch/index/reindex/RoundTripTests.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java index fba0cb20f99..d3463cdb61f 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java @@ -424,7 +424,7 @@ public abstract class AbstractBulkByScrollRequest 1) { - throw new UnsupportedOperationException("Attempting to send sliced reindex-style request to a node that doesn't support " + throw new IllegalArgumentException("Attempting to send sliced reindex-style request to a node that doesn't support " + "it. Version is [" + out.getVersion() + "] but must be [" + BulkByScrollTask.V_5_1_0_UNRELEASED + "]"); } } diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RoundTripTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RoundTripTests.java index 97e228ccfd4..ee9cbf5163d 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RoundTripTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RoundTripTests.java @@ -81,7 +81,7 @@ public class RoundTripTests extends ESTestCase { // Try slices with a version that doesn't support slices. That should fail. reindex.setSlices(between(2, 1000)); - Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, reindex, null)); + Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, reindex, null)); assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. " + "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage()); @@ -105,7 +105,7 @@ public class RoundTripTests extends ESTestCase { // Try slices with a version that doesn't support slices. That should fail. update.setSlices(between(2, 1000)); - Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, update, null)); + Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, update, null)); assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. " + "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage()); @@ -126,7 +126,7 @@ public class RoundTripTests extends ESTestCase { // Try slices with a version that doesn't support slices. That should fail. delete.setSlices(between(2, 1000)); - Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, delete, null)); + Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, delete, null)); assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. " + "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());