From 9bd70a4314cfd9f35477e909a7dc113b16686a44 Mon Sep 17 00:00:00 2001 From: Andrew Hopp Date: Fri, 31 Oct 2025 09:20:15 -0700 Subject: [PATCH 1/2] Fix recent queries not working for DQL and Lucene The Recent Queries button was not working for DQL and Lucene query languages due to two issues in the query editor: 1. The RecentQueriesTable component visibility was gated by the useQueryEditor flag, which is false for DQL/Lucene queries. 2. The onSubmit function never called addToQueryHistory(), so queries were not being saved to history in the first place. This fix removes the useQueryEditor condition from the table visibility and adds the addToQueryHistory() call in onSubmit to ensure all query languages are properly saved and displayed in recent queries. Fixes #10810 Signed-off-by: Andrew Hopp --- src/plugins/data/public/ui/query_editor/query_editor.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/public/ui/query_editor/query_editor.tsx b/src/plugins/data/public/ui/query_editor/query_editor.tsx index 34ab8cc9fd86..19553a066b45 100644 --- a/src/plugins/data/public/ui/query_editor/query_editor.tsx +++ b/src/plugins/data/public/ui/query_editor/query_editor.tsx @@ -154,6 +154,11 @@ export const QueryEditorUI: React.FC = (props) => { persistedLogRef.current.add(currentQuery.query); } + // Add query to queryString history for Recent Queries feature + if (currentQuery.query?.trim()) { + queryString.addToQueryHistory(currentQuery, dateRange); + } + props.onSubmit( { ...currentQuery, @@ -479,7 +484,7 @@ export const QueryEditorUI: React.FC = (props) => { )} From c9cc0b6ff07e40dc297833ce0466adfea2d8c4b5 Mon Sep 17 00:00:00 2001 From: Andrew Hopp Date: Fri, 31 Oct 2025 09:50:20 -0700 Subject: [PATCH 2/2] Add changeset file for PR #10837 Signed-off-by: Andrew Hopp --- changelogs/fragments/10837.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/10837.yml diff --git a/changelogs/fragments/10837.yml b/changelogs/fragments/10837.yml new file mode 100644 index 000000000000..ca7dec0eec16 --- /dev/null +++ b/changelogs/fragments/10837.yml @@ -0,0 +1,2 @@ +fix: +- Fix recent queries not working for DQL and Lucene ([#10837](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10837))