Depending on the retrieval strategy, the similarity algorithm cannot be changed at query time. It is needed to be set when creating the index mapping for field. If you need to change the similarity algorithm, you need to delete the index and recreate it with the correct distance_strategy.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    distance_strategy="COSINE"    # distance_strategy="EUCLIDEAN_DISTANCE"    # distance_strategy="DOT_PRODUCT")Retrieval StrategiesElasticsearch has big advantages over other vector only databases from its ability to support a wide range of retrieval strategies.  In this notebook we will configure ElasticsearchStore to support some of the most common retrieval strategies. By default, ElasticsearchStore uses the ApproxRetrievalStrategy.ApproxRetrievalStrategy‚ÄãThis will return the top k most similar vectors to the query vector.  The k parameter is set when the ElasticsearchStore is initialized.  The default value is 10.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    strategy=ElasticsearchStore.ApproxRetrievalStrategy())docs = db.similarity_search(query="What did the president say about Ketanji Brown Jackson?", k=10)Example: Approx with hybrid‚ÄãThis example will show how to configure ElasticsearchStore to perform a hybrid retrieval, using a combination of approximate semantic search and keyword based search. We use RRF to balance the two scores from different retrieval methods.To enable hybrid retrieval, we need to set hybrid=True in ElasticsearchStore ApproxRetrievalStrategy constructor.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    strategy=ElasticsearchStore.ApproxRetrievalStrategy(        hybrid=True,    ))When hybrid is enabled, the query performed will be a combination of approximate semantic
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. ->: Depending on the retrieval strategy, the similarity algorithm cannot be changed at query time. It is needed to be set when creating the index mapping for field. If you need to change the similarity algorithm, you need to delete the index and recreate it with the correct distance_strategy.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    distance_strategy="COSINE"    # distance_strategy="EUCLIDEAN_DISTANCE"    # distance_strategy="DOT_PRODUCT")Retrieval StrategiesElasticsearch has big advantages over other vector only databases from its ability to support a wide range of retrieval strategies.  In this notebook we will configure ElasticsearchStore to support some of the most common retrieval strategies. By default, ElasticsearchStore uses the ApproxRetrievalStrategy.ApproxRetrievalStrategy‚ÄãThis will return the top k most similar vectors to the query vector.  The k parameter is set when the ElasticsearchStore is initialized.  The default value is 10.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    strategy=ElasticsearchStore.ApproxRetrievalStrategy())docs = db.similarity_search(query="What did the president say about Ketanji Brown Jackson?", k=10)Example: Approx with hybrid‚ÄãThis example will show how to configure ElasticsearchStore to perform a hybrid retrieval, using a combination of approximate semantic search and keyword based search. We use RRF to balance the two scores from different retrieval methods.To enable hybrid retrieval, we need to set hybrid=True in ElasticsearchStore ApproxRetrievalStrategy constructor.db = ElasticsearchStore.from_documents(    docs,     embeddings,     es_url="http://localhost:9200",     index_name="test",    strategy=ElasticsearchStore.ApproxRetrievalStrategy(        hybrid=True,    ))When hybrid is enabled, the query performed will be a combination of approximate semantic