"""
    def __init__(
        self,
        index_name: str,
        embedding: Embeddings,
        es_connection: Optional["Elasticsearch"] = None,
        es_cloud_id: Optional[str] = None,
        es_user: Optional[str] = None,
        es_password: Optional[str] = None,
        vector_query_field: Optional[str] = "vector",
        query_field: Optional[str] = "text",
    ):
        """
        Initializes an instance of the ElasticKnnSearch class and sets up the
            Elasticsearch client.
        Args:
            index_name: The name of the Elasticsearch index.
            embedding: An instance of the Embeddings class, used to generate vector
                representations of text strings.
            es_connection: An existing Elasticsearch connection.
            es_cloud_id: The Cloud ID of the Elasticsearch instance. Required if
                creating a new connection.
            es_user: The username for the Elasticsearch instance. Required if
                creating a new connection.
            es_password: The password for the Elasticsearch instance. Required if
                creating a new connection.
        """
        try:
            import elasticsearch
        except ImportError:
            raise ImportError(
                "Could not import elasticsearch python package. "
                "Please install it with `pip install elasticsearch`."
            )
        self.embedding = embedding
        self.index_name = index_name
        self.query_field = query_field
        self.vector_query_field = vector_query_field
        # If a pre-existing Elasticsearch connection is provided, use it.
        if es_connection is not None:
            self.client = es_connection
        else:
            # If credentials for a new Elasticsearch connection are provided,
            # create a new connection.
            if es_cloud_id and es_user and es_password:
rtdocs_stable/api.python.langchain.com/en/stable/_modules/langchain/vectorstores/elastic_vector_search.html