Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EuiCallOut, EuiPageBody, EuiPanel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { getNestedProperty } from '@kbn/ml-nested-property';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { CreateDataViewButton } from '../../../../../components/create_data_view_button';
import { useMlKibana, useNavigateToPath } from '../../../../../contexts/kibana';
import { useToastNotificationService } from '../../../../../services/toast_notification_service';
Expand All @@ -22,6 +22,8 @@ import {

const fixedPageSize: number = 20;

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const SourceSelection: FC = () => {
const {
services: {
Expand All @@ -41,7 +43,7 @@ export const SourceSelection: FC = () => {
id: string,
type: string,
fullName?: string,
savedObject?: SavedObjectCommon
savedObject?: SavedObject
) => {
// Kibana data views including `:` are cross-cluster search indices
// and are not supported by Data Frame Analytics yet. For saved searches
Expand Down Expand Up @@ -142,6 +144,9 @@ export const SourceSelection: FC = () => {
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported in DFA, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import { type DataViewEditorService as DataViewEditorServiceSpec } from '@kbn/data-view-editor-plugin/public';
import { INDEX_PATTERN_TYPE } from '@kbn/data-views-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { createPath } from '../../routing/router';
import { ML_PAGES } from '../../../../common/constants/locator';
import { DataDriftIndexPatternsEditor } from './data_drift_index_patterns_editor';

import { MlPageHeader } from '../../components/page_header';
import { useMlKibana, useNavigateToPath } from '../../contexts/kibana';

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const DataDriftIndexOrSearchRedirect: FC = () => {
const navigateToPath = useNavigateToPath();
const { contentManagement, uiSettings } = useMlKibana().services;
Expand Down Expand Up @@ -65,6 +69,9 @@ export const DataDriftIndexOrSearchRedirect: FC = () => {
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported in Data Drift, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EuiFlexGroup, EuiPageBody, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { CreateDataViewButton } from '../../../../components/create_data_view_button';
import { useMlKibana, useNavigateToPath } from '../../../../contexts/kibana';
import { MlPageHeader } from '../../../../components/page_header';
Expand All @@ -21,6 +22,8 @@ export interface PageProps {

const RESULTS_PER_PAGE = 20;

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const Page: FC<PageProps> = ({
nextStepPath,
extraButtons,
Expand Down Expand Up @@ -69,6 +72,9 @@ export const Page: FC<PageProps> = ({
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported across ML, filter them out
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It covers:

  • Data Visualizer => Data View
  • AIOps Labs
  • Anomaly Detection => Jobs

savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import React, { type FC, Fragment } from 'react';

import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { useAppDependencies } from '../../../../app_dependencies';

interface SearchSelectionProps {
Expand All @@ -19,6 +20,8 @@ interface SearchSelectionProps {
canEditDataView: boolean;
}

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

const fixedPageSize: number = 8;

export const SearchSelection: FC<SearchSelectionProps> = ({
Expand Down Expand Up @@ -64,6 +67,9 @@ export const SearchSelection: FC<SearchSelectionProps> = ({
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly the transform wizard used to partially work when selecting an ES|QL based saved search, successfully pulling out the index pattern from the search to use in the transform. However the other commands in the search (WHERE, RENAME, DROP etc) would be ignored, so I think this change is correct, filtering out ES|QL based saved searches until if / when the transform wizard supports the whole of the search.

// ES|QL Based saved searches are not supported in transforms, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down