Skip to content

Commit

Permalink
fixed ppl polling; save dataset in saved queries (opensearch-project#…
Browse files Browse the repository at this point in the history
…8724)

* fixed ppl polling; save dataset in saved queries

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* Changeset file for PR opensearch-project#8724 created/updated

---------

Signed-off-by: Amardeepsingh Siglani <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Qxisylolo committed Oct 30, 2024
1 parent aad1de1 commit 2002e79
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 2002e79

Please sign in to comment.