Skip to main content


This page describes how to connect to your Elasticsearch database and query it from your Appsmith app.

Connect Elasticsearch


If you are a cloud user, you must whitelist the IP address of the Appsmith deployment and on your database instance or VPC before connecting to a database. For instructions on IP Filtering in Elasticsearch, see the Elasticsearch docs.

Connection parameters

The following is a reference guide that provides a description of the parameters for connecting to Elasticsearch.

Connect to Elasticsearch
Connect to Elasticsearch

Host URL

The network location where your Elasticsearch data is hosted. This can be a domain name or an IP address. To connect to a local database, see Connect Local Database for directions.


The port number to connect to on the server.

Username/Password for Basic Auth

The account credentials used to log in to Elasticsearch.

Authorization Header

Instead of the username/password fields, you can provide an Authorization Header to authenticate your queries. This field is only used when the Username/Password for Basic Auth fields are empty.

Query Elasticsearch

The following section provides examples of creating basic CRUD queries to Elasticsearch.


For details on building more complex queries, see the Elasticsearch Document API documentation.


The HTTP method to use for your query.

  • GET: Method used for requesting and fetching data.
  • POST: Method used for creating or updating records.
  • PUT: Method used for creating or updating records.
  • DELETE: Method used for deleting records.


The endpoint to which your query is sent. This usually is made up of the index name and the name of an operation. For example: /users/_search is the endpoint used for searching the users index.


The body content of your query.

Search documents

Queries run on top of indexed documents can be configured using the GET method.




"query": {
"match": {
"": {{ UsersTable.searchText }}

The example above searches the users index for a name matching your user input from a Table widget called UsersTable.

Create a document

You can create a single new document using the POST method, with a JSON body that represents the document values; an id is automatically generated.




"name": {{ }},
"email": {{ }},
"gender": {{ }},

Above, user input is collected with a Form widget called NewUserForm.

Update a document

A single document can be updated using its id within an index using a POST request.


/users/_update/{{ }}


// using a JSON Form widget to collect input
"doc": UpdateUserForm.formData

Above, the record with its id is selected from a Table widget called UsersTable and updated with input from a JSON Form widget.

This performs a partial update, where the properties you supply are added to the document; you don't need to add ones that have not changed.

Delete a document

A single document can be deleted using its id within an index using the DELETE method.


/users/_doc/{{ }}

Above, the record with its id is selected from a Table widget called UsersTable.


If you are experiencing difficulties, you can refer to the Datasource troubleshooting guide or contact the support team using the chat widget at the bottom right of this page.