diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java index 655d18645c9..08631ed18d0 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java @@ -152,7 +152,7 @@ class ScrollDataExtractor implements DataExtractor { if (timestamp != null) { if (timestampOnCancel == null) { timestampOnCancel = timestamp; - } else if (timestamp != timestampOnCancel) { + } else if (timestamp.equals(timestampOnCancel) == false) { hasNext = false; clearScroll(scrollId); break; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java index 94da286f67f..821f7d82f96 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java @@ -215,9 +215,9 @@ public class ScrollDataExtractorTests extends ESTestCase { extractor.cancel(); SearchResponse response2 = createSearchResponse( - Arrays.asList(2000L, 3000L), - Arrays.asList("a3", "a4"), - Arrays.asList("b3", "b4") + Arrays.asList(2000L, 2000L, 3000L), + Arrays.asList("a3", "a4", "a5"), + Arrays.asList("b3", "b4", "b5") ); extractor.setNextResponse(response2); @@ -225,7 +225,7 @@ public class ScrollDataExtractorTests extends ESTestCase { assertThat(extractor.hasNext(), is(true)); stream = extractor.next(); assertThat(stream.isPresent(), is(true)); - expectedStream = "{\"time\":2000,\"field_1\":\"a3\"}"; + expectedStream = "{\"time\":2000,\"field_1\":\"a3\"} {\"time\":2000,\"field_1\":\"a4\"}"; assertThat(asString(stream.get()), equalTo(expectedStream)); assertThat(extractor.hasNext(), is(false));