diff --git a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index 58f901e00a1..3f70ab1235b 100644 --- a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -5810,6 +5810,7 @@ public class InternalEngineTests extends EngineTestCase { policy.setMinMergeDocs(10000); try (InternalEngine engine = createEngine(indexSettings, store, createTempDir(), policy)) { int numDocs = between(1, 20); + logger.info("" + numDocs); for (int i = 0; i < numDocs; i++) { index(engine, i); } @@ -5842,10 +5843,15 @@ public class InternalEngineTests extends EngineTestCase { assertEquals("the delete and the tombstone", 2, leafReader.numDeletedDocs()); assertEquals(numDocs + 1, leafReader.maxDoc()); Terms id = leafReader.terms("_id"); - assertNotNull(id); - assertEquals("deleted IDs are pruned away", reader.numDocs(), id.size()); - TermsEnum iterator = id.iterator(); - assertFalse(iterator.seekExact(Uid.encodeId("0"))); + if (numDocs == 1) { + assertNull(id); // everything is pruned away + assertEquals(0, leafReader.numDocs()); + } else { + assertNotNull(id); + assertEquals("deleted IDs are pruned away", reader.numDocs(), id.size()); + TermsEnum iterator = id.iterator(); + assertFalse(iterator.seekExact(Uid.encodeId("0"))); + } } } }