in Elastic.SemanticKernel.Connectors.Elasticsearch/Internal/Helpers/VectorStoreRecordPropertyReader.cs [453:501]
public static (List<PropertyInfo> KeyProperties, List<PropertyInfo> DataProperties, List<PropertyInfo> VectorProperties) FindPropertiesInfo(Type type, VectorStoreRecordDefinition vectorStoreRecordDefinition)
{
List<PropertyInfo> keyProperties = new();
List<PropertyInfo> dataProperties = new();
List<PropertyInfo> vectorProperties = new();
foreach (VectorStoreRecordProperty property in vectorStoreRecordDefinition.Properties)
{
// Key.
if (property is VectorStoreRecordKeyProperty keyPropertyInfo)
{
var keyProperty = type.GetProperty(keyPropertyInfo.DataModelPropertyName);
if (keyProperty == null)
{
throw new ArgumentException($"Key property '{keyPropertyInfo.DataModelPropertyName}' not found on type {type.FullName}.");
}
keyProperties.Add(keyProperty);
}
// Data.
else if (property is VectorStoreRecordDataProperty dataPropertyInfo)
{
var dataProperty = type.GetProperty(dataPropertyInfo.DataModelPropertyName);
if (dataProperty == null)
{
throw new ArgumentException($"Data property '{dataPropertyInfo.DataModelPropertyName}' not found on type {type.FullName}.");
}
dataProperties.Add(dataProperty);
}
// Vector.
else if (property is VectorStoreRecordVectorProperty vectorPropertyInfo)
{
var vectorProperty = type.GetProperty(vectorPropertyInfo.DataModelPropertyName);
if (vectorProperty == null)
{
throw new ArgumentException($"Vector property '{vectorPropertyInfo.DataModelPropertyName}' not found on type {type.FullName}.");
}
vectorProperties.Add(vectorProperty);
}
else
{
throw new ArgumentException($"Unknown property type '{property.GetType().FullName}' in vector store record definition.");
}
}
return (keyProperties, dataProperties, vectorProperties);
}