in Elastic.SemanticKernel.Connectors.Elasticsearch/ElasticsearchVectorStoreCollectionCreateMapping.cs [71:94]
private static DenseVectorIndexOptionsType GetIndexKind(VectorStoreRecordVectorProperty vectorProperty)
{
const string int8HnswIndexKind = "int8_hnsw";
const string int4HnswIndexKind = "int4_hnsw";
const string int8FlatIndexKind = "int8_flat";
const string int4FlatIndexKind = "int4_flat";
if (vectorProperty.DistanceFunction is null)
{
return DenseVectorIndexOptionsType.Int8Hnsw;
}
return vectorProperty.IndexKind switch
{
IndexKind.Hnsw => DenseVectorIndexOptionsType.Hnsw,
int8HnswIndexKind => DenseVectorIndexOptionsType.Int8Hnsw,
int4HnswIndexKind => DenseVectorIndexOptionsType.Int4Hnsw,
IndexKind.Flat => DenseVectorIndexOptionsType.Flat,
int8FlatIndexKind => DenseVectorIndexOptionsType.Int8Flat,
int4FlatIndexKind => DenseVectorIndexOptionsType.Int4Flat,
_ => throw new InvalidOperationException(
$"Index kind '{vectorProperty.IndexKind}' for {nameof(VectorStoreRecordVectorProperty)} '{vectorProperty.DataModelPropertyName}' is not supported by the Elasticsearch VectorStore.")
};
}