public IVectorStoreRecordCollection GetCollection()

in Elastic.SemanticKernel.Connectors.Elasticsearch/ElasticsearchVectorStore.cs [69:92]


    public IVectorStoreRecordCollection<TKey, TRecord> GetCollection<TKey, TRecord>(string name,
        VectorStoreRecordDefinition? vectorStoreRecordDefinition = null)
        where TKey : notnull
    {
        if (typeof(TKey) != typeof(string))
        {
            throw new NotSupportedException("Only string keys are supported.");
        }

        if (_options.VectorStoreCollectionFactory is not null)
        {
            return _options.VectorStoreCollectionFactory.CreateVectorStoreRecordCollection<TKey, TRecord>(
                _elasticsearchClient.ElasticsearchClient, name, vectorStoreRecordDefinition);
        }

        var recordCollection = new ElasticsearchVectorStoreRecordCollection<TRecord>(_elasticsearchClient, name,
            new ElasticsearchVectorStoreRecordCollectionOptions<TRecord>
            {
                VectorStoreRecordDefinition = vectorStoreRecordDefinition
            });

        var castRecordCollection = recordCollection as IVectorStoreRecordCollection<TKey, TRecord>;
        return castRecordCollection!;
    }