in Elastic.SemanticKernel.Connectors.Elasticsearch/Internal/Helpers/VectorStoreRecordPropertyReader.cs [508:557]
private static VectorStoreRecordDefinition CreateVectorStoreRecordDefinitionFromType((List<PropertyInfo> KeyProperties, List<PropertyInfo> DataProperties, List<PropertyInfo> VectorProperties) propertiesInfo)
{
var definitionProperties = new List<VectorStoreRecordProperty>();
// Key properties.
foreach (var keyProperty in propertiesInfo.KeyProperties)
{
var keyAttribute = keyProperty.GetCustomAttribute<VectorStoreRecordKeyAttribute>();
if (keyAttribute is not null)
{
definitionProperties.Add(new VectorStoreRecordKeyProperty(keyProperty.Name, keyProperty.PropertyType)
{
StoragePropertyName = keyAttribute.StoragePropertyName
});
}
}
// Data properties.
foreach (var dataProperty in propertiesInfo.DataProperties)
{
var dataAttribute = dataProperty.GetCustomAttribute<VectorStoreRecordDataAttribute>();
if (dataAttribute is not null)
{
definitionProperties.Add(new VectorStoreRecordDataProperty(dataProperty.Name, dataProperty.PropertyType)
{
IsFilterable = dataAttribute.IsFilterable,
IsFullTextSearchable = dataAttribute.IsFullTextSearchable,
StoragePropertyName = dataAttribute.StoragePropertyName
});
}
}
// Vector properties.
foreach (var vectorProperty in propertiesInfo.VectorProperties)
{
var vectorAttribute = vectorProperty.GetCustomAttribute<VectorStoreRecordVectorAttribute>();
if (vectorAttribute is not null)
{
definitionProperties.Add(new VectorStoreRecordVectorProperty(vectorProperty.Name, vectorProperty.PropertyType)
{
Dimensions = vectorAttribute.Dimensions,
IndexKind = vectorAttribute.IndexKind,
DistanceFunction = vectorAttribute.DistanceFunction,
StoragePropertyName = vectorAttribute.StoragePropertyName
});
}
}
return new VectorStoreRecordDefinition { Properties = definitionProperties };
}