|
55 | 55 | import org.elasticsearch.index.codec.vectors.ES815HnswBitVectorsFormat; |
56 | 56 | import org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsFormat; |
57 | 57 | import org.elasticsearch.index.codec.vectors.es818.ES818BinaryQuantizedVectorsFormat; |
| 58 | +import org.elasticsearch.index.codec.vectors.es93.ES93BinaryQuantizedVectorsFormat; |
58 | 59 | import org.elasticsearch.index.codec.vectors.es93.ES93HnswBinaryQuantizedVectorsFormat; |
59 | 60 | import org.elasticsearch.index.fielddata.FieldDataContext; |
60 | 61 | import org.elasticsearch.index.fielddata.IndexFieldData; |
@@ -2075,6 +2076,7 @@ public BBQHnswIndexOptions(int m, int efConstruction, boolean onDiskRescore, Res |
2075 | 2076 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2076 | 2077 | return switch (elementType) { |
2077 | 2078 | case FLOAT -> new ES93HnswBinaryQuantizedVectorsFormat(m, efConstruction, onDiskRescore, false); |
| 2079 | + case BFLOAT16 -> new ES93HnswBinaryQuantizedVectorsFormat(m, efConstruction, onDiskRescore, true); |
2078 | 2080 | default -> throw new AssertionError(); |
2079 | 2081 | }; |
2080 | 2082 | } |
@@ -2142,7 +2144,8 @@ static class BBQFlatIndexOptions extends QuantizedIndexOptions { |
2142 | 2144 | @Override |
2143 | 2145 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2144 | 2146 | return switch (elementType) { |
2145 | | - case FLOAT -> new ES818BinaryQuantizedVectorsFormat(); |
| 2147 | + case FLOAT -> new ES93BinaryQuantizedVectorsFormat(false, false); |
| 2148 | + case BFLOAT16 -> new ES93BinaryQuantizedVectorsFormat(false, true); |
2146 | 2149 | default -> throw new AssertionError(); |
2147 | 2150 | }; |
2148 | 2151 | } |
@@ -2207,13 +2210,21 @@ static class BBQIVFIndexOptions extends QuantizedIndexOptions { |
2207 | 2210 |
|
2208 | 2211 | @Override |
2209 | 2212 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2210 | | - assert elementType == ElementType.FLOAT; |
2211 | | - return new ES920DiskBBQVectorsFormat( |
2212 | | - clusterSize, |
2213 | | - ES920DiskBBQVectorsFormat.DEFAULT_CENTROIDS_PER_PARENT_CLUSTER, |
2214 | | - onDiskRescore, |
2215 | | - false |
2216 | | - ); |
| 2213 | + return switch (elementType) { |
| 2214 | + case FLOAT -> new ES920DiskBBQVectorsFormat( |
| 2215 | + clusterSize, |
| 2216 | + ES920DiskBBQVectorsFormat.DEFAULT_CENTROIDS_PER_PARENT_CLUSTER, |
| 2217 | + onDiskRescore, |
| 2218 | + false |
| 2219 | + ); |
| 2220 | + case BFLOAT16 -> new ES920DiskBBQVectorsFormat( |
| 2221 | + clusterSize, |
| 2222 | + ES920DiskBBQVectorsFormat.DEFAULT_CENTROIDS_PER_PARENT_CLUSTER, |
| 2223 | + onDiskRescore, |
| 2224 | + true |
| 2225 | + ); |
| 2226 | + default -> throw new AssertionError(); |
| 2227 | + }; |
2217 | 2228 | } |
2218 | 2229 |
|
2219 | 2230 | @Override |
|
0 commit comments