diff --git a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsWriter.java b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsWriter.java index 53cdd35bc09..de52c5e4840 100644 --- a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsWriter.java +++ b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsWriter.java @@ -92,7 +92,6 @@ final class TermVectorsWriter { final boolean useDocsAndPos = positions || offsets || payloads; while (iterator.next() != null) { // iterate all terms of the current field BytesRef termBytesRef = iterator.term(); - boolean foundTerm = topLevelIterator.seekExact(termBytesRef); Term term = new Term(field, termBytesRef); // with filtering we only keep the best terms @@ -107,6 +106,7 @@ final class TermVectorsWriter { final TermStatistics statistics = dfs.termStatistics().get(term); writeTermStatistics(statistics == null ? new TermStatistics(termBytesRef, 0, 0) : statistics); } else { + boolean foundTerm = topLevelIterator.seekExact(termBytesRef); if (foundTerm) { writeTermStatistics(topLevelIterator); } else {