How does es fetch the right source with stale docIDs, after lucene merged queried segments

Deleted documents are dropped when segments are merged, which will change the follows' docID.
so how does es fetch the right source with stale docIDs.

It keeps hold of the old segments until all the searches that are using them have finished.

How to hold?
I don't find any filter to skip segments using by searches in findMerges source code.

It works because org.apache.lucene.index.IndexReader is ref-counted, and we use the same IndexReader for all phases of a search.

1 Like

Thanks, it's resolved my puzzle.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.