mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-01 19:03:25 +00:00
docs: another auth method for ElasticsearchStore (#16831)
Users can also use their own Elasticsearch client object to configure the connection.
This commit is contained in:
parent
4986e7227e
commit
604e117411
@ -92,6 +92,28 @@
|
|||||||
" )\n",
|
" )\n",
|
||||||
"```\n",
|
"```\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",
|
"#### How to obtain a password for the default \"elastic\" user?\n",
|
||||||
"\n",
|
"\n",
|
||||||
"To obtain your Elastic Cloud password for the default \"elastic\" user:\n",
|
"To obtain your Elastic Cloud password for the default \"elastic\" user:\n",
|
||||||
@ -134,7 +156,7 @@
|
|||||||
"id": "ea167a29",
|
"id": "ea167a29",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"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."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user