Skip to content

Commit 1252fba

Browse files
committed
assert doc stats
1 parent c6159ad commit 1252fba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterQueryWithPartialResultsIT.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import static org.elasticsearch.xpack.esql.EsqlTestUtils.getValuesList;
3737
import static org.hamcrest.Matchers.containsString;
3838
import static org.hamcrest.Matchers.equalTo;
39+
import static org.hamcrest.Matchers.greaterThan;
3940
import static org.hamcrest.Matchers.in;
4041
import static org.hamcrest.Matchers.is;
4142
import static org.hamcrest.Matchers.lessThanOrEqualTo;
@@ -310,13 +311,18 @@ private Set<String> populateIndexWithFailingFields(String clusterAlias, String i
310311
);
311312
Set<String> ids = new HashSet<>();
312313
String tag = clusterAlias.isEmpty() ? "local" : clusterAlias;
313-
int numDocs = between(50, 100); // large enough to have failing documents in every shard
314+
int numDocs = between(1, 100); // large enough to have failing documents in every shard
314315
for (int i = 0; i < numDocs; i++) {
315316
String id = Long.toString(nextDocId.incrementAndGet());
316317
client.prepareIndex(indexName).setSource("id", id, "tag", tag, "v", i).get();
317318
ids.add(id);
318319
}
319320
client.admin().indices().prepareRefresh(indexName).get();
321+
for (var shardStats : client.admin().indices().prepareStats(indexName).clear().setDocs(true).get().getShards()) {
322+
var docsStats = shardStats.getStats().docs;
323+
assertNotNull(docsStats);
324+
assertThat("no doc for shard " + shardStats.getShardRouting().shardId(), docsStats.getCount(), greaterThan(0L));
325+
}
320326
return ids;
321327
}
322328
}

0 commit comments

Comments
 (0)