diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/id/simple/SimpleIdCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/id/simple/SimpleIdCache.java index 30974da5ce1..e08a777544a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/id/simple/SimpleIdCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/id/simple/SimpleIdCache.java @@ -149,7 +149,6 @@ public class SimpleIdCache extends AbstractIndexComponent implements IdCache, In Map readerBuilder = builders.get(reader.getCoreCacheKey()); - int t = 1; // current term number (0 indicated null value) String field = StringHelper.intern(ParentFieldMapper.NAME); TermDocs termDocs = reader.termDocs(); TermEnum termEnum = reader.terms(new Term(field)); @@ -178,11 +177,11 @@ public class SimpleIdCache extends AbstractIndexComponent implements IdCache, In typeBuilder.parentIdsValues.add(idAsBytes); added = true; } - typeBuilder.parentIdsOrdinals[termDocs.doc()] = t; + typeBuilder.parentIdsOrdinals[termDocs.doc()] = typeBuilder.t; } } if (added) { - t++; + typeBuilder.t++; } } while (termEnum.next()); } finally { @@ -241,6 +240,7 @@ public class SimpleIdCache extends AbstractIndexComponent implements IdCache, In final ExtTObjectIntHasMap idToDoc = new ExtTObjectIntHasMap(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, -1); final ArrayList parentIdsValues = new ArrayList(); final int[] parentIdsOrdinals; + int t = 1; // current term number (0 indicated null value) TypeBuilder(IndexReader reader) { parentIdsOrdinals = new int[reader.maxDoc()];