From b4ea718597af452e6925007508e8bd7be91ed9e7 Mon Sep 17 00:00:00 2001 From: Max Jakob Date: Wed, 31 Jan 2024 13:52:32 +0100 Subject: [PATCH] ElasticsearchStore: document another auth method --- .../vectorstores/elasticsearch.ipynb | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/docs/integrations/vectorstores/elasticsearch.ipynb b/docs/docs/integrations/vectorstores/elasticsearch.ipynb index 9032e698c2a1c..c36c6f65ee632 100644 --- a/docs/docs/integrations/vectorstores/elasticsearch.ipynb +++ b/docs/docs/integrations/vectorstores/elasticsearch.ipynb @@ -92,6 +92,28 @@ " )\n", "```\n", "\n", + "You can also use an `Elasticsearch` client object that gives you more flexibility, for example to configure the maximum number of retries.\n", + "\n", + "Example:\n", + "```python\n", + " import elasticsearch\n", + " from langchain_community.vectorstores import ElasticsearchStore\n", + "\n", + " es_client= elasticsearch.Elasticsearch(\n", + " hosts=[\"http://localhost:9200\"],\n", + " es_user=\"elastic\",\n", + " es_password=\"changeme\"\n", + " max_retries=10,\n", + " )\n", + "\n", + " embedding = OpenAIEmbeddings()\n", + " elastic_vector_search = ElasticsearchStore(\n", + " index_name=\"test_index\",\n", + " es_connection=es_client,\n", + " embedding=embedding,\n", + " )\n", + "```\n", + "\n", "#### How to obtain a password for the default \"elastic\" user?\n", "\n", "To obtain your Elastic Cloud password for the default \"elastic\" user:\n", @@ -134,7 +156,7 @@ "id": "ea167a29", "metadata": {}, "source": [ - "We want to use `OpenAIEmbeddings` so we have to get the OpenAI API Key." + "To use the `OpenAIEmbeddings` we have to configure the OpenAI API Key in the environment." ] }, {