Skip to content

Commit

Permalink
fixed ppl polling; save dataset in saved queries (#8724) (#8745)
Browse files Browse the repository at this point in the history
* fixed ppl polling; save dataset in saved queries



* Changeset file for PR #8724 created/updated

---------



(cherry picked from commit 48bfe2c)

Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 30, 2024
1 parent 21e84cb commit 103bd2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8724.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Polling for PPL results; Saved dataset to saved queries ([#8724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8724))
11 changes: 8 additions & 3 deletions src/plugins/data/public/query/saved_query/saved_query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { first } from 'rxjs/operators';
import { SavedQueryAttributes, SavedQuery, SavedQueryService } from './types';
import { QueryStringContract } from '../query_string';
import { getUseNewSavedQueriesUI } from '../../services';
import { UI_SETTINGS } from '../../../common';

type SerializedSavedQueryAttributes = SavedObjectAttributes & SavedQueryAttributes;

Expand All @@ -42,7 +43,8 @@ export const createSavedQueryService = (
coreStartServices: { application: CoreStart['application']; uiSettings: CoreStart['uiSettings'] },
queryStringManager?: QueryStringContract
): SavedQueryService => {
const { application } = coreStartServices;
const { application, uiSettings } = coreStartServices;
const queryEnhancementEnabled = uiSettings.get(UI_SETTINGS.QUERY_ENHANCEMENTS_ENABLED);

const saveQuery = async (attributes: SavedQueryAttributes, { overwrite = false } = {}) => {
if (!attributes.title.length) {
Expand All @@ -58,7 +60,7 @@ export const createSavedQueryService = (
language: attributes.query.language,
};

if (getUseNewSavedQueriesUI() && attributes.query.dataset) {
if (queryEnhancementEnabled && attributes.query.dataset) {
query.dataset = attributes.query.dataset;
}

Expand Down Expand Up @@ -182,8 +184,11 @@ export const createSavedQueryService = (
},
};

if (getUseNewSavedQueriesUI()) {
if (queryEnhancementEnabled) {
savedQueryItem.query.dataset = savedQuery.attributes.query.dataset;
}

if (getUseNewSavedQueriesUI()) {
savedQueryItem.isTemplate = !!savedQuery.attributes.isTemplate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class PPLSearchInterceptor extends SearchInterceptor {
http: this.deps.http,
path: trimEnd(`${API.SEARCH}/${strategy}`),
signal,
body: {
pollQueryResultsParams: request.params?.pollQueryResultsParams,
},
};

const query = this.buildQuery();
Expand Down

0 comments on commit 103bd2d

Please sign in to comment.