Class ElasticsearchConfigurationScript

java.lang.Object
dev.langchain4j.store.embedding.elasticsearch.ElasticsearchConfigurationScript
All Implemented Interfaces:
ElasticsearchConfiguration

public class ElasticsearchConfigurationScript extends Object implements ElasticsearchConfiguration
Represents an Elasticsearch index as an embedding store. Current implementation assumes the index uses the cosine distance metric.
Supports storing Metadata and filtering by it using Filter (provided inside EmbeddingSearchRequest).
See Also:
  • Method Details

    • builder

    • isIncludeVectorResponse

      public boolean isIncludeVectorResponse()
      Description copied from interface: ElasticsearchConfiguration
      Temporary method which returns if we should return the Vector in the response
      Specified by:
      isIncludeVectorResponse in interface ElasticsearchConfiguration
      Returns:
      true or false
    • vectorSearch

      public co.elastic.clients.elasticsearch.core.SearchResponse<Document> vectorSearch(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName, dev.langchain4j.store.embedding.EmbeddingSearchRequest embeddingSearchRequest) throws co.elastic.clients.elasticsearch._types.ElasticsearchException, IOException
      Description copied from interface: ElasticsearchConfiguration
      Used for vector search
      Specified by:
      vectorSearch in interface ElasticsearchConfiguration
      Parameters:
      client - The Elasticsearch client
      indexName - The index name
      embeddingSearchRequest - The embedding search request
      Returns:
      The search response
      Throws:
      co.elastic.clients.elasticsearch._types.ElasticsearchException - if an error occurs during the search
      IOException - if an I/O error occurs