Langchain + Elasticsearch

์•ˆ๋…•ํ•˜์„ธ์š”. ๊ธฐ์กด์˜ elasticsearch์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ด์šฉํ•˜๊ณ  ์‹ถ์–ด์„œ langchain๊ณผ elasticsearch๋ฅผ ์—ฐ๋™ํ•˜๊ณ  ์‹ถ์–ด ๊ณต์‹๋ฌธ์„œ๋ฅผ ๋ณด๊ณ  ๋”ฐ๋ผํ•˜๋˜ ์ค‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ด ์งˆ๋ฌธ ๋‚จ๊น๋‹ˆ๋‹ค..!

โ€˜โ€˜โ€˜

import elasticsearch

from langchain_elasticsearch import ElasticsearchStore

es_client= elasticsearch.Elasticsearch(

hosts=["http://localhost:9200"],

es_user="elastic",

es_password="changeme"

max_retries=10,

)

embedding = OpenAIEmbeddings()

elastic_vector_search = ElasticsearchStore(

index_name="test_index",

es_connection=es_client,

embedding=embedding,

)

โ€˜โ€˜โ€˜

์œ„์˜ ์ฝ”๋“œ๋Š” ๊ณต์‹๋ฌธ์„œ์— ๋‚˜์™€์žˆ๋Š” ์ฝ”๋“œ์ธ๋ฐ

elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: ProtocolError(('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))))

์ด๋ ‡๊ฒŒ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๊ฑฐ๋‚˜ https๋กœ url์„ ์„ค์ •ํ•˜๋ฉด

elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1133)))

์ด๋ ‡๊ฒŒ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

ํ˜น์‹œ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์„ ์•„์‹œ๋Š” ๋ถ„์ด ๊ณ„์‹œ๋‹ค๋ฉด ๋‹ต๋ณ€ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค..! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

1
1๊ฐœ์˜ ๋‹ต๊ธ€

๐Ÿ‘€ ๋‹ต๋ณ€์„ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ์–ด์š”!

๐Ÿ™Œ ์ƒˆ๋กœ์šด ๋ฉค๋ฒ„๋“ค์„ ๋งž์•„์ฃผ์„ธ์š”!