afrom_texts(
cls,
texts: List[str],
embedding: Optional[Embeddings]| Name | Type | Description |
|---|---|---|
texts* | List[str] | List of texts to add to the Elasticsearch index. |
embedding | Optional[Embeddings] | Default: NoneEmbedding function to use to embed the texts. |
metadatas | Optional[List[Dict[str, Any]]] | Default: None |
bulk_kwargs | Optional[Dict] | Default: None |
client | Optional[AsyncElasticsearch] | Default: None |
**kwargs | Any | Default: {} |
Construct ElasticsearchStore wrapper from raw documents.
Example:
from langchain_elasticsearch.vectorstores import ElasticsearchStore
from langchain_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"
)Optional list of metadatas associated with the texts.
Optional. Additional arguments to pass to Elasticsearch bulk.
Optional pre-existing client connection.
Alternatively, provide credentials (es_url, es_cloud_id, etc.).
Additional keyword arguments passed to the constructor.
See AsyncElasticsearchStore or ElasticsearchStore for supported
options including index_name, es_url, cloud_id, es_user,
es_password,
es_api_key, vector_query_field, query_field, and
distance_strategy.