diff --git a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java index 7dcf1c47567e0..a7eeef8e823a2 100644 --- a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java +++ b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClustersIT.java @@ -530,10 +530,16 @@ public void testNotLikeListKeyword() throws Exception { """, includeCCSMetadata); var columns = List.of(Map.of("name", "c", "type", "long"), Map.of("name", "_index", "type", "keyword")); Predicate filter = d -> false == (d.color.contains("blue") || d.color.contains("red")); - var values = List.of( - List.of((int) remoteDocs.stream().filter(filter).count(), REMOTE_CLUSTER_NAME + ":" + remoteIndex), - List.of((int) localDocs.stream().filter(filter).count(), localIndex) - ); + + var values = new ArrayList<>(); + int remoteCount = (int) remoteDocs.stream().filter(filter).count(); + int localCount = (int) localDocs.stream().filter(filter).count(); + if (remoteCount > 0) { + values.add(List.of(remoteCount, REMOTE_CLUSTER_NAME + ":" + remoteIndex)); + } + if (localCount > 0) { + values.add(List.of(localCount, localIndex)); + } assertResultMapForLike(includeCCSMetadata, result, columns, values, false, true); }