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)) 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) => { )}