Class TSDBSyntheticIdCodec

java.lang.Object
org.apache.lucene.codecs.Codec
org.apache.lucene.codecs.FilterCodec
org.elasticsearch.index.codec.tsdb.TSDBSyntheticIdCodec
All Implemented Interfaces:
org.apache.lucene.util.NamedSPILoader.NamedSPI

public class TSDBSyntheticIdCodec extends org.apache.lucene.codecs.FilterCodec
Special codec for time-series datastreams that use synthetic ids.

The role of this codec is to ensure that no inverted index is created when indexing a document id in Lucene, while allowing the usage of terms and postings on the field (now called a "synthetic _id" field) as if it was backed by an in inverted index.

In order to do this, it wraps the default postings format with an implementation that throws an IllegalArgumentException if a Lucene field with the name _id produces terms (ie, has postings) during indexing. It also overwrites the FieldInfos to ensure that the _id field information has the IndexOptions.NONE option when written to disk. It also changes this IndexOptions.NONE option back to IndexOptions.DOCS when reading the FieldInfos during the opening of a new segment core reader. This allows to use a Lucene term dictionary on top of a synthetic _id field that does not have corresponding postings files on disk. Finally, the codec injects additional FieldInfos attributes so that Lucene's PerFieldPostingsFormat correctly instantiates a TSDBSyntheticIdPostingsFormat to access the term and postings of the synthetic _id field.

  • Field Summary

    Fields inherited from class org.apache.lucene.codecs.FilterCodec

    delegate
  • Constructor Summary

    Constructors
    Constructor
    Description
    TSDBSyntheticIdCodec(String name, org.apache.lucene.codecs.Codec delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.apache.lucene.codecs.FieldInfosFormat
     
    org.apache.lucene.codecs.PostingsFormat
     

    Methods inherited from class org.apache.lucene.codecs.FilterCodec

    compoundFormat, docValuesFormat, knnVectorsFormat, liveDocsFormat, normsFormat, pointsFormat, segmentInfoFormat, storedFieldsFormat, termVectorsFormat

    Methods inherited from class org.apache.lucene.codecs.Codec

    availableCodecs, forName, getDefault, getName, reloadCodecs, setDefault, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TSDBSyntheticIdCodec

      public TSDBSyntheticIdCodec(String name, org.apache.lucene.codecs.Codec delegate)
  • Method Details

    • fieldInfosFormat

      public final org.apache.lucene.codecs.FieldInfosFormat fieldInfosFormat()
      Overrides:
      fieldInfosFormat in class org.apache.lucene.codecs.FilterCodec
    • postingsFormat

      public org.apache.lucene.codecs.PostingsFormat postingsFormat()
      Overrides:
      postingsFormat in class org.apache.lucene.codecs.FilterCodec