Link Search Menu Expand Document Documentation Menu

You're viewing version 2.9 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Running queries in the Dev Tools console

Use the Dev Tools console to send queries to OpenSearch. To access the Dev Tools console, select Dev Tools under the Management menu on the OpenSearch Dashboards home page.

Writing queries

Write your queries in the editor pane on the left side of the console:

Request pane

Collapse or expand your query by selecting the triangle next to the line numbers.

To learn more about writing queries in OpenSearch domain-specific language (DSL), see Query DSL.

Comments

Use # at the beginning of a line to write single-line comments.

Autocomplete

OpenSearch provides autocomplete suggestions for fields, indexes and their aliases, and templates. To configure autocomplete preferences, update them in Console Settings.

Sending the request

To send a query to OpenSearch, select the query by placing the cursor anywhere in the query text. Then choose the play icon (play icon) on the upper right of the request or press Ctrl/Cmd+Enter:

Send request

OpenSearch displays the response in the response pane on the right side of the console:

Response pane

Working in the cURL and console formats

The console uses an easier syntax to format REST requests than the curl command.

For example, the following curl command runs a search query:

```bash
curl -XGET http://localhost:9200/shakespeare/_search?pretty -H 'Content-Type: application/json' -d'
{
  "query": {
    "match": {
      "text_entry": "To be, or not to be"
    }
  }
}'
```
<label hidden class="copy-label">copy</label>

The same query has a simpler syntax in the console format:

```json
GET shakespeare/_search
{
  "query": {
    "match": {
      "text_entry": "To be, or not to be"
    }
  }
}
```
<label hidden class="copy-curl-label">copy</label>

If you paste a curl command directly into the console, the command is automatically converted into the format the console uses.

To import a query in cURL format, select the query, select the wrench icon (wrench icon), and choose Copy as cURL:

Console tools

Viewing documentation

To view the OpenSearch documentation, select the wrench icon (wrench icon) and choose Open documentation.

Auto indenting

To use auto indent, select the queries that you want to format, select the wrench icon (wrench icon), and choose Auto indent.

Auto indenting a collapsed query expands it.

Auto indenting a well-formatted query puts the request body on a single line. This is useful for working with bulk APIs.

Viewing your request history

You can view up to the 500 most recent requests that OpenSearch ran successfully. To view request history, select History from the top menu. If you select the request you want to view from the left pane, the query is shown in the right pane.

To copy the query into the editor pane, select the query text and then select Apply.

To clear the history, select Clear.

Updating the console settings

To update your preferences, select Settings from the top menu:

Settings

Using keyboard shortcuts

To view all available keyboard shortcuts, select Help from the top menu.