cloud_id – Cloud ID of the Elasticsearch instance to connect to.
es_user – Username to use when connecting to Elasticsearch.
es_password – Password to use when connecting to Elasticsearch.
es_api_key – API key to use when connecting to Elasticsearch.
es_connection – Optional pre-existing Elasticsearch connection.
vector_query_field – Optional. Name of the field
to store the embedding vectors in.
query_field – Optional. Name of the field to store the texts in.
bulk_kwargs – Optional. Additional arguments to pass to
Elasticsearch bulk.
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[Dict[str, Any]]] = None, bulk_kwargs: Optional[Dict] = None, **kwargs: Any) → ElasticsearchStore[source]¶
Construct ElasticsearchStore wrapper from raw documents.
Example
from langchain.vectorstores import ElasticsearchStore
from langchain.embeddings.openai import OpenAIEmbeddings
db = ElasticsearchStore.from_texts(
    texts,
    // embeddings optional if using
    // a strategy that doesn't require inference
    embeddings,
    index_name="langchain-demo",
    es_url="http://localhost:9200"
)
Parameters
texts – List of texts to add to the Elasticsearch index.
embedding – Embedding function to use to embed the texts.
metadatas – Optional list of metadatas associated with the texts.
index_name – Name of the Elasticsearch index to create.
es_url – URL of the Elasticsearch instance to connect to.
cloud_id – Cloud ID of the Elasticsearch instance to connect to.
es_user – Username to use when connecting to Elasticsearch.
es_password – Password to use when connecting to Elasticsearch.
es_api_key – API key to use when connecting to Elasticsearch.
es_connection – Optional pre-existing Elasticsearch connection.