Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryAWS DynamoDBCassandramemoryElasticsearch Chat Message HistoryMomento CacheMongodDBMot√∂rheadPostgresRedisRemembrallRocksetSingleStoreDBSQL (SQLAlchemy)SQLiteStreamlitUpstash Redis Chat Message HistoryXataZepCallbacksChat loadersComponentsMemorymemoryElasticsearch Chat Message HistoryOn this pageElasticsearch Chat Message HistoryElasticsearch is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library.This notebook shows how to use chat message history functionality with Elasticsearch.Set up Elasticsearch‚ÄãThere are two main ways to set up an Elasticsearch instance:Elastic Cloud. Elastic Cloud is a managed Elasticsearch service. Sign up for a free trial.Local Elasticsearch installation. Get started with Elasticsearch by running it locally. The easiest way is to use the official Elasticsearch Docker image. See the Elasticsearch Docker documentation for more information.Install dependencies‚Äã%pip install elasticsearch langchainInitialize Elasticsearch client and chat message history‚Äãimport osfrom langchain.memory import ElasticsearchChatMessageHistoryes_url = os.environ.get("ES_URL", "http://localhost:9200")# If using Elastic Cloud:# es_cloud_id = os.environ.get("ES_CLOUD_ID")# Note: see Authentication section for various authentication methodshistory = ElasticsearchChatMessageHistory(    es_url=es_url,    index="test-history",    session_id="test-session")Use the chat message history‚Äãhistory.add_user_message("hi!")history.add_ai_message("whats up?")    indexing message content='hi!' additional_kwargs={} example=False    indexing message content='whats up?'
Elasticsearch is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library.
Elasticsearch is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryAWS DynamoDBCassandramemoryElasticsearch Chat Message HistoryMomento CacheMongodDBMot√∂rheadPostgresRedisRemembrallRocksetSingleStoreDBSQL (SQLAlchemy)SQLiteStreamlitUpstash Redis Chat Message HistoryXataZepCallbacksChat loadersComponentsMemorymemoryElasticsearch Chat Message HistoryOn this pageElasticsearch Chat Message HistoryElasticsearch is a distributed, RESTful search and analytics engine, capable of performing both vector and lexical search. It is built on top of the Apache Lucene library.This notebook shows how to use chat message history functionality with Elasticsearch.Set up Elasticsearch‚ÄãThere are two main ways to set up an Elasticsearch instance:Elastic Cloud. Elastic Cloud is a managed Elasticsearch service. Sign up for a free trial.Local Elasticsearch installation. Get started with Elasticsearch by running it locally. The easiest way is to use the official Elasticsearch Docker image. See the Elasticsearch Docker documentation for more information.Install dependencies‚Äã%pip install elasticsearch langchainInitialize Elasticsearch client and chat message history‚Äãimport osfrom langchain.memory import ElasticsearchChatMessageHistoryes_url = os.environ.get("ES_URL", "http://localhost:9200")# If using Elastic Cloud:# es_cloud_id = os.environ.get("ES_CLOUD_ID")# Note: see Authentication section for various authentication methodshistory = ElasticsearchChatMessageHistory(    es_url=es_url,    index="test-history",    session_id="test-session")Use the chat message history‚Äãhistory.add_user_message("hi!")history.add_ai_message("whats up?")    indexing message content='hi!' additional_kwargs={} example=False    indexing message content='whats up?'