Module org.elasticsearch.server
Class VersionsAndSeqNoResolver
java.lang.Object
org.elasticsearch.common.lucene.uid.VersionsAndSeqNoResolver
Utility class to resolve the Lucene doc ID, version, seqNo and primaryTerms for a given uid.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWraps anLeafReaderContext, a doc ID relative to the context doc base and a seqNo.static classWraps anLeafReaderContext, a doc ID relative to the context doc base and a version. -
Method Summary
Modifier and TypeMethodDescriptionloadDocIdAndSeqNo(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef term) Loads the internal docId and sequence number of the latest copy for a given uid from the provided reader.loadDocIdAndVersionUncached(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef term, boolean loadSeqNo) timeSeriesLoadDocIdAndVersion(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef term, boolean loadSeqNo) 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 otherwisetimeSeriesLoadDocIdAndVersion(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef uid, String id, boolean loadSeqNo) A special variant of loading docid and version in case of time series indices.
-
Method Details
-
timeSeriesLoadDocIdAndVersion
public static VersionsAndSeqNoResolver.DocIdAndVersion timeSeriesLoadDocIdAndVersion(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef 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.util.BytesRef 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
nullif 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.util.BytesRef term, boolean loadSeqNo) throws IOException - Throws:
IOException
-
loadDocIdAndSeqNo
public static VersionsAndSeqNoResolver.DocIdAndSeqNo loadDocIdAndSeqNo(org.apache.lucene.index.IndexReader reader, org.apache.lucene.util.BytesRef 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
-