> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/sql-commands/connections/create-connection/elasticsearch.md).

# Elasticsearch

To write your transformed data into an Elasticsearch index using Upsolver, you must first create a connection that provides the appropriate credentials to access your cluster.

## Syntax

```sql
CREATE ELASTICSEARCH CONNECTION <connection_identifier> 
    CONNECTION_STRING = '<connection_string>'
    USER_NAME = 'your_user'
    PASSWORD = 'your_password';
```

**Jump to**

* [`CONNECTION_STRING`](#connection_string-editable)
* [`USER_NAME`](#user_name-editable-with-password)
* [`PASSWORD`](#password-editable-with-user_name)
* [`COMMENT`](#comment-editable)

## Connection options

#### `CONNECTION_STRING` — editable

Type: `text`

The connection string to use when connecting to the cluster.

Format:&#x20;

```sql
'elasticsearch://host:port?cluster.name=your_cluster_name'
```

#### `USER_NAME` — editable with `password`

Type: `text`

The user to authenticate to the cluster.

#### `PASSWORD` — editable with `user_name`

Type: `text`

The password for the user.

#### `COMMENT` — editable

Type: `text`

(Optional) A description or comment regarding this connection.

## Example

```sql
CREATE ELASTICSEARCH CONNECTION my_elasticsearch
    CONNECTION_STRING = 'elasticsearch://
        search-elastic1-tiq6hb7ltwvcu2vwp3tbixyzey.us-east-1.es.amazonaws.com:443?
        cluster.name=elastic_main&ssl=true'
    USER_NAME = 'your_user'
    PASSWORD = 'your_password'
    COMMENT = 'My new Elasticsearch connection';
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/reference-1/sql-commands/connections/create-connection/elasticsearch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
