Elasticsearch is a distributed, RESTful search and analytics engine. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. It supports keyword search, vector search, hybrid search and complex filtering.The
ElasticsearchRetriever
is a generic wrapper to enable flexible access to all Elasticsearch
features through the Query DSL. For most use cases the other classes (ElasticsearchStore
, ElasticsearchEmbeddings
, etc.) should suffice, but if they don’t you can use ElasticsearchRetriever
.
This guide will help you get started with the Elasticsearch retriever. For detailed documentation of all ElasticsearchRetriever
features and configurations head to the API reference.
langchain-elasticsearch
package. For demonstration purposes, we will also install langchain-community
to generate text embeddings.
ElasticsearchRetriever
when they already have data in an Elasticsearch index. Here we index some example text documents. If you created an index for example using ElasticsearchStore.from_documents
that’s also fine.
.invoke
to issue a single query. Because retrievers are Runnables, we can use any method in the Runnable interface, such as .batch
, as well.
ElasticsearchRetriever
features and configurations head to the API reference.