= "This is a single query."query_embedding = embeddings.embed_query(query)# Print query embeddingprint(f"Embedding for query: {query_embedding}")Testing with Existing Elasticsearch client connection‚ÄãThis can be used with any Elasticsearch deployment# Create Elasticsearch connectiones_connection = Elasticsearch(    hosts=["https://es_cluster_url:port"], basic_auth=("user", "password"))# Instantiate ElasticsearchEmbeddings using es_connectionembeddings = ElasticsearchEmbeddings.from_es_connection(    model_id,    es_connection,)# Create embeddings for multiple documentsdocuments = [    "This is an example document.",    "Another example document to generate embeddings for.",]document_embeddings = embeddings.embed_documents(documents)# Print document embeddingsfor i, embedding in enumerate(document_embeddings):    print(f"Embedding for document {i+1}: {embedding}")# Create an embedding for a single queryquery = "This is a single query."query_embedding = embeddings.embed_query(query)# Print query embeddingprint(f"Embedding for query: {query_embedding}")PreviousEDEN AINextEmbaasTesting with from_credentialsTesting with Existing Elasticsearch client connectionCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Walkthrough of how to generate embeddings using a hosted embedding model in Elasticsearch
Walkthrough of how to generate embeddings using a hosted embedding model in Elasticsearch ->: = "This is a single query."query_embedding = embeddings.embed_query(query)# Print query embeddingprint(f"Embedding for query: {query_embedding}")Testing with Existing Elasticsearch client connection‚ÄãThis can be used with any Elasticsearch deployment# Create Elasticsearch connectiones_connection = Elasticsearch(    hosts=["https://es_cluster_url:port"], basic_auth=("user", "password"))# Instantiate ElasticsearchEmbeddings using es_connectionembeddings = ElasticsearchEmbeddings.from_es_connection(    model_id,    es_connection,)# Create embeddings for multiple documentsdocuments = [    "This is an example document.",    "Another example document to generate embeddings for.",]document_embeddings = embeddings.embed_documents(documents)# Print document embeddingsfor i, embedding in enumerate(document_embeddings):    print(f"Embedding for document {i+1}: {embedding}")# Create an embedding for a single queryquery = "This is a single query."query_embedding = embeddings.embed_query(query)# Print query embeddingprint(f"Embedding for query: {query_embedding}")PreviousEDEN AINextEmbaasTesting with from_credentialsTesting with Existing Elasticsearch client connectionCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.