---
title: Query history and saved queries
description: Find queries you ran recently in Explore, save the ones you reuse, and edit, rename, duplicate, or favorite saved queries from the Query history drawer.
url: https://coralogix.com/docs/user-guides/data_exploration/query-history/
product: data-exploration
feature: Explorer v2
feature_id: explorer-v2
feature_identifier: data-exploration/explorer-v2
last_updated: '2026-11-17'
---

# Query history and saved queries

Use the **Query history** drawer in Explore to rerun a query without retyping it. Explore records each query you run, and you can save the ones you reuse with a name. You can then find them by name, mark favorites, and edit a saved query's text without rebuilding it in the query bar.

A saved query stores only the query: its text, syntax (Lucene or DataPrime), datasets, and the Builder options that come with it. It doesn't store the time range, layout, or columns. To keep a full investigation setup, save a view instead. See [Explore views, tabs, and queries](https://coralogix.com/docs/user-guides/data_exploration/views_queries.md).

[![Query history drawer on the Saved queries list, with the Logs data type selector, search, Favorites first sort, and a saved DataPrime query card](/docs/assets/images/query-history-drawer-c50f4cd1e62a4e9468736f3df878abcf.webp)](https://coralogix.com/docs/assets/images/query-history-drawer-c50f4cd1e62a4e9468736f3df878abcf.webp)

## Open query history

Open the drawer in one of these ways:

* Select in the query bar, then select **Query history**.
* Press **⌘ + Shift + H** (Mac) or **Ctrl + Shift + H** (Windows and Linux).
* In the Lucene editor, open the suggestions list and select the query history button in its footer.

The drawer opens beside your results with the search field in focus. Use the full-view toggle at the top of the drawer to expand it, and select the close button to dismiss it.

## Find a query

The drawer has two lists:

* **Recent**: queries you ran recently, recorded automatically. Explore keeps up to 50 recent queries per browser, and they aren't shared with other users or devices.
* **Saved queries**: queries you saved with a name. Saved queries are stored in your Coralogix account, so they're available from any browser or device you sign in on, and they stay until you delete them. Clearing your browser data doesn't remove them.

Queries you saved in a browser before saved queries moved to your account are copied to your account automatically. Recent queries aren't copied.

Above the list, narrow down what you see:

* **Logs**, **Spans**, or **JSON data**: in the data type selector, select the type of dataset whose queries you want to see.
* **Search queries**: type part of a query name or of the query text.
* **Sort** (Saved queries only): select **Favorites first**, **Recently used**, **Recently created**, or **Name A–Z**.

Each card shows the query's name, or **Unsaved query** for a recent query you haven't saved, and when it was run or saved. On the **Recent** list, a query you already saved shows a **Saved** badge. Select a card to expand it and see the full query and its datasets.

A card shows the query the way you wrote it:

* **Lucene**: the Lucene expression, followed by the Builder options the query carries, each labeled the way the Builder labels it. A collapsed card shows the **Aggregation** and **Group By** options, plus the **Errors** switch for a spans query. An expanded card also shows **Order By** and **Limit**.
* **DataPrime**: the full query.

## Run a query from history

Hover over a card and select **Load query**. Explore applies the query to the active tab and closes the drawer.

To keep your current tab as it is, open the card's menu and select **Open in new tab**. This option is unavailable when you already have the maximum number of tabs open. Close a tab to open another one.

To copy the query text to your clipboard, select **Copy query** from the same menu.

## Save a query

Saving takes one step. Explore names the query for you if you don't type a name, and you can rename it at any time.

### From the Query history drawer

1. On the **Recent** list, hover over the query you want to keep.
2. Type a name in the name field, or press **Tab** to fill in the suggested name.
3. Select **Save**, or press **Enter**.

If you leave the name field empty, the query is saved as **Lucene draft N** or **DataPrime draft N**, using the next free number. The **Saved queries** button shows a dot until you open that list.

[![Recent list in the Query history drawer, with name fields showing the suggested draft names and Load query and Save on unsaved queries](/docs/assets/images/query-history-recent-save-15030e51fc89927d6aa795734bb87edd.webp)](https://coralogix.com/docs/assets/images/query-history-recent-save-15030e51fc89927d6aa795734bb87edd.webp)

### From the query bar

1. Build or run the query you want to keep.
2. Select in the query bar, then select **Save query**.

Explore saves the query right away under the next draft name and confirms it in a notification. If the same query on the same datasets is already saved, Explore tells you the name it's saved under instead of saving it again. Rename the query later from the drawer.

### From the Lucene editor's recent searches

When you select the Lucene search bar, the suggestions list shows your **Recent searches**.

1. Hover over a recent search, or move to it with the arrow keys. Its time is replaced by **Save**.
2. Select **Save**.

The query is saved under the next draft name, and the row shows a **Saved** badge. Saving doesn't run the query or close the list. A recent search that's already saved shows the **Saved** badge instead of **Save**.

<!-- -->

<!-- -->

## Name rules

A saved query name:

* Can't be empty.
* Can be up to 50 characters.
* Must be different from your other saved query names.

Explore shows a message under the name field when a name breaks one of these rules, and doesn't save until you fix it.

## Manage saved queries

### Rename a saved query

1. Select the query's name on its card.
2. Type the new name.
3. Press **Enter** or select **Save**. Press **Esc** to keep the old name.

### Mark a favorite

Select the star on a saved query's card, or select **Add to favorites** from its menu. Select it again to remove the favorite. Sort by **Favorites first** to keep favorites at the top of **Saved queries**.

### Edit a saved query

Change a saved query's text without loading it into Explore.

1. On the **Saved queries** list, open the query's menu and select **Edit query**.

2. Edit the query in the editor that opens inside the card. The editor uses the query's own syntax, Lucene or DataPrime, and suggests fields from the query's datasets.

3. Select one of these options:

   <!-- -->

   * **Update**: overwrite the saved query. Its name, description, and favorite status stay the same.
   * **Save as new**: save the edited query as a copy named after the original with a number added, for example **Errors (2)**. The original stays as it was.
   * **Cancel**: stop editing and discard your changes.

**Update** and **Save as new** become available only after you change the text and the editor confirms the query is valid.

[![Saved DataPrime query card in edit mode, with the query editor and the Cancel, Save as new, and Update buttons](/docs/assets/images/edit-saved-query-203f7d716148869d01276db2b3bccd62.webp)](https://coralogix.com/docs/assets/images/edit-saved-query-203f7d716148869d01276db2b3bccd62.webp)

Keep in mind:

* You can edit only the query text. For a Lucene query, the Builder options, such as group by and aggregation, show read-only under the editor. To change them, load the query, edit it in Explore, and save it again.
* To change the name, finish editing first, then [rename the query](#rename-a-saved-query).
* You can edit one saved query at a time. While you edit one, **Edit query** is unavailable on the other cards.
* If you press **Esc** or collapse the card after changing the text, Explore asks whether to discard your changes. Select **Keep editing** to go back to the editor, or **Discard** to stop editing. With no changes, the editor closes right away. Closing the drawer discards unsaved changes without asking.
* The other controls in the drawer, such as the lists, filters, and search, are unavailable while you edit.

### Duplicate a saved query

1. Open the saved query's menu and select **Duplicate**.
2. In the **Duplicate query** panel, keep the suggested name or enter a different one.
3. Optionally, add a **Description** of up to 150 characters.
4. Select **Save**.

The panel shows a **Query preview** with the query and its datasets. Expand the preview to see the full query.

### Delete a query

Open the query's menu, select **Delete query**, and confirm. You can delete both saved and recent queries. Deleting a saved query is permanent.

## Related resources

* [Explore views, tabs, and queries](https://coralogix.com/docs/user-guides/data_exploration/views_queries.md)
* [Keyboard shortcuts](https://coralogix.com/docs/user-guides/data_exploration/keyboard-shortcuts.md)
* [Query Builder](https://coralogix.com/docs/user-guides/data_exploration/query_builder.md)
* [Query with DataPrime](https://coralogix.com/docs/user-guides/data_exploration/dataprime.md)
