Class VersionsAndSeqNoResolver

java.lang.Object
org.elasticsearch.common.lucene.uid.VersionsAndSeqNoResolver

public final class VersionsAndSeqNoResolver extends Object
Utility class to resolve the Lucene doc ID, version, seqNo and primaryTerms for a given uid.
  • Method Details

    • timeSeriesLoadDocIdAndVersion

      public static VersionsAndSeqNoResolver.DocIdAndVersion timeSeriesLoadDocIdAndVersion(org.apache.lucene.index.IndexReader reader, org.apache.lucene.index.Term term, boolean loadSeqNo) throws IOException
      Load the internal doc ID and version for the uid from the reader, returning
      • null if the uid wasn't found,
      • a doc ID and a version otherwise
      Throws:
      IOException
    • timeSeriesLoadDocIdAndVersion

      public static VersionsAndSeqNoResolver.DocIdAndVersion timeSeriesLoadDocIdAndVersion(org.apache.lucene.index.IndexReader reader, org.apache.lucene.index.Term uid, String id, boolean loadSeqNo) throws IOException
      A special variant of loading docid and version in case of time series indices.

      Makes use of the fact that timestamp is part of the id, the existence of @timestamp field and that segments are sorted by DataStream.TIMESERIES_LEAF_READERS_SORTER. This allows this method to know whether there is no document with the specified id without loading the docid for the specified id.

      Parameters:
      reader - The reader load docid, version and seqno from.
      uid - The term that describes the uid of the document to load docid, version and seqno for.
      id - The id that contains the encoded timestamp. The timestamp is used to skip checking the id for entire segments.
      loadSeqNo - Whether to load sequence number from _seq_no doc values field.
      Returns:
      the internal doc ID and version for the specified term from the specified reader or returning null if no document was found for the specified id
      Throws:
      IOException - In case of an i/o related failure
    • loadDocIdAndVersionUncached

      public static VersionsAndSeqNoResolver.DocIdAndVersion loadDocIdAndVersionUncached(org.apache.lucene.index.IndexReader reader, org.apache.lucene.index.Term term, boolean loadSeqNo) throws IOException
      Throws:
      IOException
    • loadDocIdAndSeqNo

      public static VersionsAndSeqNoResolver.DocIdAndSeqNo loadDocIdAndSeqNo(org.apache.lucene.index.IndexReader reader, org.apache.lucene.index.Term term) throws IOException
      Loads the internal docId and sequence number of the latest copy for a given uid from the provided reader. The result is either null or the live and latest version of the given uid.
      Throws:
      IOException