Run API requestsedit

Interact with the REST APIs of Elasticsearch and Kibana with Console. With Console, you can:

  • Send requests and view the responses
  • View API documentation
  • Get your request history

To get started, open the main menu, click Dev Tools, then click Console.

Console

Write requestsedit

Console understands commands in a cURL-like syntax. For example, the following is a GET request to the Elasticsearch _search API.

GET /_search
{
  "query": {
    "match_all": {}
  }
}

Here is the equivalent command in cURL:

curl -XGET "http://localhost:9200/_search" -d'
{
  "query": {
    "match_all": {}
  }
}'

Prepend requests to a Kibana API endpoint with kbn:

GET kbn:/api/index_management/indices

When you paste the command into Console, Kibana automatically converts it to Console syntax. Alternatively, if you want to see Console syntax in cURL, click the action icon (wrench) and select Copy as cURL. Once copied, the username and password will need to be provided for the calls to work from external environments.

Autocompleteedit

When you’re typing a command, Console makes context-sensitive suggestions. These suggestions show you the parameters for each API and speed up your typing. To configure your preferences for autocomplete, go to Settings.

Commentsedit

You can write comments or temporarily disable parts of a request by using double forward slashes or pound signs to create single-line comments.

# This request searches all of your indices.
GET /_search
{
  // The query parameter indicates query context.
  "query": {
    "match_all": {} // Matches all documents.
  }
}

You can also use a forward slash followed by an asterisk to mark the beginning of multi-line comments. An asterisk followed by a forward slash marks the end.

GET /_search
{
  "query": {
    /*"match_all": {
      "boost": 1.2
    }*/
    "match_none": {}
  }
}

Variablesedit

Click Variables to create, edit, and delete variables.

Variables

You can refer to these variables in the paths and bodies of your requests. Each variable can be referenced multiple times.

GET ${pathVariable}
{
  "query": {
    "match": {
      "${bodyNameVariable}": "${bodyValueVariable}"
    }
  }
}

Auto-formattingedit

The auto-formatting capability can help you format requests. Select one or more requests that you want to format, click the action icon (wrench), and then select Auto indent.

For example, you might have a request formatted like this:

Unformatted request

Console adjusts the JSON body of the request to apply the indents.

Formatted request

If you select Auto indent on a request that is already well formatted, Console collapses the request body to a single line per document. This is helpful when working with the Elasticsearch bulk APIs.

Submit requestsedit

When you’re ready to submit the request to Elasticsearch, click the green triangle.

You can select multiple requests and submit them together. Console sends the requests to Elasticsearch one by one and shows the output in the response pane. Submitting multiple requests is helpful when you’re debugging an issue or trying query combinations in multiple scenarios.

View API docsedit

To view the documentation for an API endpoint, click the action icon (wrench) and select Open documentation.

Get your request historyedit

Console maintains a list of the last 500 requests that Elasticsearch successfully executed. To view your most recent requests, click History. If you select a request and click Apply, Kibana adds it to the editor at the current cursor position.

Configure Console settingsedit

You can configure the Console font size, JSON syntax, and autocomplete suggestions in Settings.

Console Settings

Get keyboard shortcutsedit

For a list of available keyboard shortcuts, click Help.

Disable Consoleedit

If you don’t want to use Console, you can disable it by setting console.ui.enabled to false in your kibana.yml configuration file. Changing this setting causes the server to regenerate assets on the next startup, which might cause a delay before pages start being served.