Saving queries

edit

A saved query is a portable collection of query text and filters that you can reuse in Discover, Visualize, and Dashboard. Save a query when you want to:

  • Retrieve results from the same query at a later time without having to reenter the query text, add the filters or set the time filter
  • View the results of the same query in multiple apps
  • Share your query

Saved queries don’t include information specific to Discover, such as the currently selected columns in the document table, the sort order, and the index pattern. If you want to save your current view of Discover for later retrieval and reuse, create a saved search instead.

Read only access

edit

If you have insufficient privileges to save queries, the Save current query button isn’t visible in the saved query management popover. For more information, see Granting access to Kibana

Save a query

edit

To save the current query text, filters, and time filter:

  1. Click # in the search bar, next to the query text input.
  2. Click Save current query in the popover.

    Example of the saved query management popover with a list of saved queries with write access
  3. Enter a name, a description, and then select the filter options that you want to include. By default, filters are automatically included, but the time filter is not.

    Example of the saved query management save form with the filters option included and the time filter option excluded
  4. Click Save.

Load a query

edit

To load a saved query into Discover, Dashboard, or Visualize:

  1. Click # in the search bar, next to the query text input.
  2. Select the query you want to load. You might need to scroll down to find the query you are looking for.

Save changes to a query

edit

If you load a query and then make changes to the query text, the filters, or the time filter, you can save the changes as a new query or update the existing query.

To save the changes as a new query:

  1. Click # in the search bar, next to the query text input.
  2. Click Save as new in the popover.
  3. Enter a name and a description, and then select the filter options that you want to include.
  4. Click Save.

    Example of the saved query management popover when a query is loaded and we have made changes to the query

To save the changes to the current query:

  1. Click # in the search bar.
  2. Click Save changes in the popover.
  3. Enter a description, and then select the filter options that you want to include.
  4. Click Save.

Clear a query

edit

To clear a query that is currently loaded in an application:

  1. Click # in the search bar.
  2. Click Clear in the popover.

Delete a query

edit

To completely delete a query:

  1. Click # in the search bar, next to the query text input.
  2. Hover over the query you want to delete.
  3. Click the trash can icon.

    Example of the saved query management popover when a query is hovered over and we are about to delete a query

You can import, export, and delete saved queries from Saved Objects in Management.