Class AbstractHnswVectorsFormat

java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
org.elasticsearch.index.codec.vectors.AbstractHnswVectorsFormat
All Implemented Interfaces:
org.apache.lucene.util.NamedSPILoader.NamedSPI
Direct Known Subclasses:
ES814HnswScalarQuantizedVectorsFormat, ES815HnswBitVectorsFormat, ES816HnswBinaryQuantizedVectorsFormat, ES818HnswBinaryQuantizedVectorsFormat

public abstract class AbstractHnswVectorsFormat extends org.apache.lucene.codecs.KnnVectorsFormat
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
    The number of candidate neighbors to track while searching the graph for each newly inserted node.
    protected final int
    Controls how many of the nearest neighbor candidates are connected to the new node.
    protected final org.apache.lucene.search.TaskExecutor
     
    protected final int
     

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

    DEFAULT_MAX_DIMENSIONS, EMPTY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a format using default graph construction parameters
    protected
    AbstractHnswVectorsFormat(String name, int maxConn, int beamWidth)
    Constructs a format using the given graph construction parameters.
    protected
    AbstractHnswVectorsFormat(String name, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)
    Constructs a format using the given graph construction parameters and scalar quantization.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract org.apache.lucene.codecs.hnsw.FlatVectorsFormat
     
    int
     
     

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

    availableKnnVectorsFormats, fieldsReader, fieldsWriter, forName, getName, reloadKnnVectorsFormat

    Methods inherited from class java.lang.Object

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

    • maxConn

      protected final int maxConn
      Controls how many of the nearest neighbor candidates are connected to the new node. Defaults to Lucene99HnswVectorsFormat.DEFAULT_MAX_CONN. See HnswGraph for more details.
    • beamWidth

      protected final int beamWidth
      The number of candidate neighbors to track while searching the graph for each newly inserted node. Defaults to Lucene99HnswVectorsFormat.DEFAULT_BEAM_WIDTH. See HnswGraph for details.
    • numMergeWorkers

      protected final int numMergeWorkers
    • mergeExec

      protected final org.apache.lucene.search.TaskExecutor mergeExec
  • Constructor Details

    • AbstractHnswVectorsFormat

      protected AbstractHnswVectorsFormat(String name)
      Constructs a format using default graph construction parameters
    • AbstractHnswVectorsFormat

      protected AbstractHnswVectorsFormat(String name, int maxConn, int beamWidth)
      Constructs a format using the given graph construction parameters.
      Parameters:
      maxConn - the maximum number of connections to a node in the HNSW graph
      beamWidth - the size of the queue maintained during graph construction.
    • AbstractHnswVectorsFormat

      protected AbstractHnswVectorsFormat(String name, int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)
      Constructs a format using the given graph construction parameters and scalar quantization.
      Parameters:
      maxConn - the maximum number of connections to a node in the HNSW graph
      beamWidth - the size of the queue maintained during graph construction.
      numMergeWorkers - number of workers (threads) that will be used when doing merge. If larger than 1, a non-null ExecutorService must be passed as mergeExec
      mergeExec - the ExecutorService that will be used by ALL vector writers that are generated by this format to do the merge
  • Method Details

    • flatVectorsFormat

      protected abstract org.apache.lucene.codecs.hnsw.FlatVectorsFormat flatVectorsFormat()
    • getMaxDimensions

      public int getMaxDimensions(String fieldName)
      Specified by:
      getMaxDimensions in class org.apache.lucene.codecs.KnnVectorsFormat
    • toString

      public String toString()
      Overrides:
      toString in class Object