# Elasticsearch

## Create the Elasticsearch data source

The first step is to create the data source and provide the Elasticsearch cluster URL and optionally provide  the basic auth `login` and `password`.

![Configuring the Elasticsearch data source](https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LmzGprckLqwd5v6bs6m%2Fuploads%2F6Layf9Qws0F2LKh6O22C%2Felastic-1.png?alt=media\&token=a74876c7-6d73-4922-b027-eaeb94a927c0)

## Writing queries

In the query editor view, select the *Elasticsearch data source* created above. On the left column, click on the refresh <img src="https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmzGprckLqwd5v6bs6m%2F-MEQsRwF4OYKT4vFbous%2F-MEQul15FkfgLR3MdC0b%2FScreen%20Shot%202020-08-10%20at%2010.07.50%20PM.png?alt=media&#x26;token=2e70a73c-2379-4f09-8b9a-2a870f5331af" alt="" data-size="original"> icon to refresh the schemes (indexes). The schemes are expandable and show the schema details.

![Refresh and lookup Elasticsearch indexes](https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LmzGprckLqwd5v6bs6m%2Fuploads%2FM2BYNQx3OfYqZ6BSjxPi%2Felastic-2.png?alt=media\&token=09a6e327-2624-4f63-a48a-c17fef88d983)

You can then proceed to the query editor and run the search query. The query uses JSON as passed to the Elasticsearch search API

![Writing a search query against an Elasticsearch index](https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LmzGprckLqwd5v6bs6m%2Fuploads%2FVZbnimHpsZ3dtAqKo96Q%2FScreenshot%20from%202022-06-29%2023-04-10.png?alt=media\&token=2cfdbe87-7acd-4307-99c2-c59d5189ccb4)
