Module org.elasticsearch.server
Class ES920DiskBBQVectorsWriter
java.lang.Object
org.apache.lucene.codecs.KnnVectorsWriter
org.elasticsearch.index.codec.vectors.diskbbq.IVFVectorsWriter
org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable
Default implementation of
IVFVectorsWriter. It uses HierarchicalKMeans algorithm to
partition the vector space, and then stores the centroids and posting list in a sequential
fashion.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.index.codec.vectors.diskbbq.IVFVectorsWriter
IVFVectorsWriter.CentroidOffsetAndLengthNested classes/interfaces inherited from class org.apache.lucene.codecs.KnnVectorsWriter
org.apache.lucene.codecs.KnnVectorsWriter.MergedVectorValues -
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionES920DiskBBQVectorsWriter(org.apache.lucene.index.SegmentWriteState state, String rawVectorFormatName, boolean useDirectIOReads, org.apache.lucene.codecs.hnsw.FlatVectorsWriter rawVectorDelegate, int vectorPerCluster, int centroidsPerParentCluster, org.apache.lucene.search.TaskExecutor mergeExec, int numMergeWorkers, int flatVectorThreshold) -
Method Summary
Modifier and TypeMethodDescriptionbuildAndWritePostingsLists(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, org.apache.lucene.index.FloatVectorValues floatVectorValues, org.apache.lucene.store.IndexOutput postingsOutput, long fileOffset, int[] assignments, int[] overspillAssignments) buildAndWritePostingsLists(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, org.apache.lucene.index.FloatVectorValues floatVectorValues, org.apache.lucene.store.IndexOutput postingsOutput, long fileOffset, org.apache.lucene.index.MergeState mergeState, int[] assignments, int[] overspillAssignments) calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, KMeansFloatVectorValues floatVectorValues) Calculate the centroids for the given field.calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, KMeansFloatVectorValues floatVectorValues, org.apache.lucene.index.MergeState mergeState) createCentroidSupplier(org.apache.lucene.index.FieldInfo info, float[][] centroids, float[] globalCentroid) createCentroidSupplier(org.apache.lucene.store.IndexInput centroidsInput, int numCentroids, org.apache.lucene.index.FieldInfo fieldInfo, float[] globalCentroid) protected PreconditionercreatePreconditioner(int dimension) voiddoWriteMeta(org.apache.lucene.store.IndexOutput ivfMeta, org.apache.lucene.index.FieldInfo field, int numCentroids, long preconditionerOfffset, long preconditionerLength) protected PreconditionerinheritPreconditioner(org.apache.lucene.index.FieldInfo fieldInfo, org.apache.lucene.index.MergeState mergeState) preconditionVectors(Preconditioner preconditioner) protected org.apache.lucene.index.FloatVectorValuespreconditionVectors(Preconditioner Preconditioner, org.apache.lucene.index.FloatVectorValues vectors) voidwriteCentroids(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, int[] centroidAssignments, float[] globalCentroid, IVFVectorsWriter.CentroidOffsetAndLength centroidOffsetAndLength, org.apache.lucene.store.IndexOutput centroidOutput) voidwriteCentroids(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, int[] centroidAssignments, float[] globalCentroid, IVFVectorsWriter.CentroidOffsetAndLength centroidOffsetAndLength, org.apache.lucene.store.IndexOutput centroidOutput, org.apache.lucene.index.MergeState mergeState) protected voidwritePreconditioner(Preconditioner Preconditioner, org.apache.lucene.store.IndexOutput out) Methods inherited from class org.elasticsearch.index.codec.vectors.diskbbq.IVFVectorsWriter
addField, close, finish, flush, mergeOneField, ramBytesUsedMethods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
mapOldOrdToNewOrd, mergeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
ES920DiskBBQVectorsWriter
public ES920DiskBBQVectorsWriter(org.apache.lucene.index.SegmentWriteState state, String rawVectorFormatName, boolean useDirectIOReads, org.apache.lucene.codecs.hnsw.FlatVectorsWriter rawVectorDelegate, int vectorPerCluster, int centroidsPerParentCluster, org.apache.lucene.search.TaskExecutor mergeExec, int numMergeWorkers, int flatVectorThreshold) throws IOException - Throws:
IOException
-
-
Method Details
-
buildAndWritePostingsLists
public IVFVectorsWriter.CentroidOffsetAndLength buildAndWritePostingsLists(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, org.apache.lucene.index.FloatVectorValues floatVectorValues, org.apache.lucene.store.IndexOutput postingsOutput, long fileOffset, int[] assignments, int[] overspillAssignments) throws IOException - Specified by:
buildAndWritePostingsListsin classIVFVectorsWriter- Throws:
IOException
-
buildAndWritePostingsLists
public IVFVectorsWriter.CentroidOffsetAndLength buildAndWritePostingsLists(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, org.apache.lucene.index.FloatVectorValues floatVectorValues, org.apache.lucene.store.IndexOutput postingsOutput, long fileOffset, org.apache.lucene.index.MergeState mergeState, int[] assignments, int[] overspillAssignments) throws IOException - Specified by:
buildAndWritePostingsListsin classIVFVectorsWriter- Throws:
IOException
-
createCentroidSupplier
public CentroidSupplier createCentroidSupplier(org.apache.lucene.index.FieldInfo info, float[][] centroids, float[] globalCentroid) throws IOException - Specified by:
createCentroidSupplierin classIVFVectorsWriter- Throws:
IOException
-
createCentroidSupplier
public CentroidSupplier createCentroidSupplier(org.apache.lucene.store.IndexInput centroidsInput, int numCentroids, org.apache.lucene.index.FieldInfo fieldInfo, float[] globalCentroid) throws IOException - Specified by:
createCentroidSupplierin classIVFVectorsWriter- Throws:
IOException
-
inheritPreconditioner
protected Preconditioner inheritPreconditioner(org.apache.lucene.index.FieldInfo fieldInfo, org.apache.lucene.index.MergeState mergeState) throws IOException - Specified by:
inheritPreconditionerin classIVFVectorsWriter- Throws:
IOException
-
createPreconditioner
- Specified by:
createPreconditionerin classIVFVectorsWriter
-
preconditionVectors
protected org.apache.lucene.index.FloatVectorValues preconditionVectors(Preconditioner Preconditioner, org.apache.lucene.index.FloatVectorValues vectors) - Specified by:
preconditionVectorsin classIVFVectorsWriter
-
preconditionVectors
- Specified by:
preconditionVectorsin classIVFVectorsWriter
-
writePreconditioner
protected void writePreconditioner(Preconditioner Preconditioner, org.apache.lucene.store.IndexOutput out) throws IOException - Specified by:
writePreconditionerin classIVFVectorsWriter- Throws:
IOException
-
writeCentroids
public void writeCentroids(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, int[] centroidAssignments, float[] globalCentroid, IVFVectorsWriter.CentroidOffsetAndLength centroidOffsetAndLength, org.apache.lucene.store.IndexOutput centroidOutput) throws IOException - Specified by:
writeCentroidsin classIVFVectorsWriter- Throws:
IOException
-
writeCentroids
public void writeCentroids(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, int[] centroidAssignments, float[] globalCentroid, IVFVectorsWriter.CentroidOffsetAndLength centroidOffsetAndLength, org.apache.lucene.store.IndexOutput centroidOutput, org.apache.lucene.index.MergeState mergeState) throws IOException - Specified by:
writeCentroidsin classIVFVectorsWriter- Throws:
IOException
-
doWriteMeta
public void doWriteMeta(org.apache.lucene.store.IndexOutput ivfMeta, org.apache.lucene.index.FieldInfo field, int numCentroids, long preconditionerOfffset, long preconditionerLength) throws IOException - Specified by:
doWriteMetain classIVFVectorsWriter- Throws:
IOException
-
calculateCentroids
public CentroidAssignments calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, KMeansFloatVectorValues floatVectorValues, org.apache.lucene.index.MergeState mergeState) throws IOException - Specified by:
calculateCentroidsin classIVFVectorsWriter- Throws:
IOException
-
calculateCentroids
public CentroidAssignments calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, KMeansFloatVectorValues floatVectorValues) throws IOException Calculate the centroids for the given field. We use theHierarchicalKMeansalgorithm to partition the space of all vectors across merging segments- Specified by:
calculateCentroidsin classIVFVectorsWriter- Parameters:
fieldInfo- merging field infofloatVectorValues- the float vector values to merge- Returns:
- the vector assignments, soar assignments, and if asked the centroids themselves that were computed
- Throws:
IOException- if an I/O error occurs
-