New Retriever‚Äãelasticsearch_url = "http://localhost:9200"retriever = ElasticSearchBM25Retriever.create(elasticsearch_url, "langchain-index-4")# Alternatively, you can load an existing index# import elasticsearch# elasticsearch_url="http://localhost:9200"# retriever = ElasticSearchBM25Retriever(elasticsearch.Elasticsearch(elasticsearch_url), "langchain-index")Add texts (if necessary)‚ÄãWe can optionally add texts to the retriever (if they aren't already in there)retriever.add_texts(["foo", "bar", "world", "hello", "foo bar"])    ['cbd4cb47-8d9f-4f34-b80e-ea871bc49856',     'f3bd2e24-76d1-4f9b-826b-ec4c0e8c7365',     '8631bfc8-7c12-48ee-ab56-8ad5f373676e',     '8be8374c-3253-4d87-928d-d73550a2ecf0',     'd79f457b-2842-4eab-ae10-77aa420b53d7']Use Retriever‚ÄãWe can now use the retriever!result = retriever.get_relevant_documents("foo")result    [Document(page_content='foo', metadata={}),     Document(page_content='foo bar', metadata={})]PreviousDocArrayNextGoogle Cloud Enterprise SearchCreate New RetrieverAdd texts (if necessary)Use RetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Elasticsearch is a distributed, RESTful search and analytics engine. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.
Elasticsearch is a distributed, RESTful search and analytics engine. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. ->: New Retriever‚Äãelasticsearch_url = "http://localhost:9200"retriever = ElasticSearchBM25Retriever.create(elasticsearch_url, "langchain-index-4")# Alternatively, you can load an existing index# import elasticsearch# elasticsearch_url="http://localhost:9200"# retriever = ElasticSearchBM25Retriever(elasticsearch.Elasticsearch(elasticsearch_url), "langchain-index")Add texts (if necessary)‚ÄãWe can optionally add texts to the retriever (if they aren't already in there)retriever.add_texts(["foo", "bar", "world", "hello", "foo bar"])    ['cbd4cb47-8d9f-4f34-b80e-ea871bc49856',     'f3bd2e24-76d1-4f9b-826b-ec4c0e8c7365',     '8631bfc8-7c12-48ee-ab56-8ad5f373676e',     '8be8374c-3253-4d87-928d-d73550a2ecf0',     'd79f457b-2842-4eab-ae10-77aa420b53d7']Use Retriever‚ÄãWe can now use the retriever!result = retriever.get_relevant_documents("foo")result    [Document(page_content='foo', metadata={}),     Document(page_content='foo bar', metadata={})]PreviousDocArrayNextGoogle Cloud Enterprise SearchCreate New RetrieverAdd texts (if necessary)Use RetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.