Class ElasticsearchConfigurationHybrid

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

public class ElasticsearchConfigurationHybrid extends Object implements ElasticsearchConfiguration
Represents an Elasticsearch index as an embedding store using rff to combine a kNN query and a full text search.
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
    • hybridSearch

      public co.elastic.clients.elasticsearch.core.SearchResponse<Document> hybridSearch(co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName, dev.langchain4j.store.embedding.EmbeddingSearchRequest embeddingSearchRequest, String textQuery) throws co.elastic.clients.elasticsearch._types.ElasticsearchException, IOException
      Description copied from interface: ElasticsearchConfiguration
      Used for hybrid search
      Specified by:
      hybridSearch in interface ElasticsearchConfiguration
      Parameters:
      client - The Elasticsearch client
      indexName - The index name
      embeddingSearchRequest - The embedding search request
      textQuery - The text query
      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