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) -
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, org.apache.lucene.index.FloatVectorValues floatVectorValues) Calculate the centroids for the given field.calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, org.apache.lucene.index.FloatVectorValues floatVectorValues, org.apache.lucene.index.MergeState mergeState) createCentroidSupplier(org.apache.lucene.store.IndexInput centroidsInput, int numCentroids, org.apache.lucene.index.FieldInfo fieldInfo, float[] globalCentroid) voiddoWriteMeta(org.apache.lucene.store.IndexOutput ivfMeta, org.apache.lucene.index.FieldInfo field, int numCentroids) voidwriteCentroids(org.apache.lucene.index.FieldInfo fieldInfo, CentroidSupplier centroidSupplier, int[] centroidAssignments, float[] globalCentroid, IVFVectorsWriter.CentroidOffsetAndLength centroidOffsetAndLength, org.apache.lucene.store.IndexOutput centroidOutput) 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) 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.store.IndexInput centroidsInput, int numCentroids, org.apache.lucene.index.FieldInfo fieldInfo, float[] globalCentroid) - Specified by:
createCentroidSupplierin classIVFVectorsWriter
-
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
-
doWriteMeta
public void doWriteMeta(org.apache.lucene.store.IndexOutput ivfMeta, org.apache.lucene.index.FieldInfo field, int numCentroids) - Specified by:
doWriteMetain classIVFVectorsWriter
-
calculateCentroids
public CentroidAssignments calculateCentroids(org.apache.lucene.index.FieldInfo fieldInfo, org.apache.lucene.index.FloatVectorValues 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, org.apache.lucene.index.FloatVectorValues 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
-