Skip to content

Commit

Permalink
[8.x] [ML] Hide ES|QL based saved searches in ML & Transforms (#1…
Browse files Browse the repository at this point in the history
…95084) (#195541)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Hide ES|QL based saved searches in ML & Transforms
(#195084)](#195084)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-09T08:14:50Z","message":"[ML]
Hide ES|QL based saved searches in ML & Transforms (#195084)\n\n##
Summary\r\n\r\nFix for:
[#187962](https://github.com/elastic/kibana/issues/187962)\r\nWe were
displaying ES|QL based searches in various areas of ML, not just\r\nin
the places mentioned in the issue.\r\nBefore:\r\n![Screenshot 2024-10-04
at 16
16\r\n26](https://github.com/user-attachments/assets/dff7e1d6-4c8e-4916-acec-c6b9931c2a39)\r\nThen,
after selecting the ESQL based
search:\r\n\r\n![image](https://github.com/user-attachments/assets/9314cd0b-442a-4287-9d29-799e172f929a)\r\nAfter
the
fix:\r\n\r\n![image](https://github.com/user-attachments/assets/e660ef24-c585-4d95-bcf1-2578ec9e663d)","sha":"1b4ebaa85261074aec775d23165474863ddea45a","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v9.0.0","Team:ML","v8.16.0","backport:version"],"title":"[ML]
Hide ES|QL based saved searches in ML &
Transforms","number":195084,"url":"https://github.com/elastic/kibana/pull/195084","mergeCommit":{"message":"[ML]
Hide ES|QL based saved searches in ML & Transforms (#195084)\n\n##
Summary\r\n\r\nFix for:
[#187962](https://github.com/elastic/kibana/issues/187962)\r\nWe were
displaying ES|QL based searches in various areas of ML, not just\r\nin
the places mentioned in the issue.\r\nBefore:\r\n![Screenshot 2024-10-04
at 16
16\r\n26](https://github.com/user-attachments/assets/dff7e1d6-4c8e-4916-acec-c6b9931c2a39)\r\nThen,
after selecting the ESQL based
search:\r\n\r\n![image](https://github.com/user-attachments/assets/9314cd0b-442a-4287-9d29-799e172f929a)\r\nAfter
the
fix:\r\n\r\n![image](https://github.com/user-attachments/assets/e660ef24-c585-4d95-bcf1-2578ec9e663d)","sha":"1b4ebaa85261074aec775d23165474863ddea45a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195084","number":195084,"mergeCommit":{"message":"[ML]
Hide ES|QL based saved searches in ML & Transforms (#195084)\n\n##
Summary\r\n\r\nFix for:
[#187962](https://github.com/elastic/kibana/issues/187962)\r\nWe were
displaying ES|QL based searches in various areas of ML, not just\r\nin
the places mentioned in the issue.\r\nBefore:\r\n![Screenshot 2024-10-04
at 16
16\r\n26](https://github.com/user-attachments/assets/dff7e1d6-4c8e-4916-acec-c6b9931c2a39)\r\nThen,
after selecting the ESQL based
search:\r\n\r\n![image](https://github.com/user-attachments/assets/9314cd0b-442a-4287-9d29-799e172f929a)\r\nAfter
the
fix:\r\n\r\n![image](https://github.com/user-attachments/assets/e660ef24-c585-4d95-bcf1-2578ec9e663d)","sha":"1b4ebaa85261074aec775d23165474863ddea45a"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Jaszczurek <[email protected]>
  • Loading branch information
kibanamachine and rbrtj authored Oct 9, 2024
1 parent 128dcb6 commit b8d7596
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
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
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) =>
// ES|QL Based saved searches are not supported in transforms, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down

0 comments on commit b8d7596

Please sign in to comment.