diff --git a/modules/reindex/src/main/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSource.java b/modules/reindex/src/main/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSource.java index 17df6b1d4c5..369b5fe2ef5 100644 --- a/modules/reindex/src/main/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSource.java +++ b/modules/reindex/src/main/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSource.java @@ -186,8 +186,9 @@ public class RemoteScrollableHitSource extends ScrollableHitSource { } if (xContentType == null) { try { + logger.debug("Response didn't include Content-Type: " + bodyMessage(response.getEntity())); throw new OpenSearchException( - "Response didn't include Content-Type: " + bodyMessage(response.getEntity())); + "Response didn't include supported Content-Type, remote is likely not an OpenSearch instance"); } catch (IOException e) { OpenSearchException ee = new OpenSearchException("Error extracting body from response"); ee.addSuppressed(e); diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSourceTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSourceTests.java index 25599d9af56..5bc92addae6 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSourceTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/remote/RemoteScrollableHitSourceTests.java @@ -94,7 +94,6 @@ import java.util.stream.Stream; import static org.opensearch.common.unit.TimeValue.timeValueMillis; import static org.opensearch.common.unit.TimeValue.timeValueMinutes; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.instanceOf; @@ -472,7 +471,7 @@ public class RemoteScrollableHitSourceTests extends OpenSearchTestCase { public void testNoContentTypeIsError() { RuntimeException e = expectListenerFailure(RuntimeException.class, (RejectAwareActionListener listener) -> sourceWithMockedRemoteCall(false, null, "main/0_20_5.json").lookupRemoteVersion(listener)); - assertThat(e.getMessage(), containsString("Response didn't include Content-Type: body={")); + assertEquals(e.getMessage(), "Response didn't include supported Content-Type, remote is likely not an OpenSearch instance"); } public void testInvalidJsonThinksRemoteIsNotES() throws IOException {