[8.x] [ML] Hide ES|QL based saved searches in ML & Transforms (#195084) (#195541)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Hide ES|QL based saved searches in ML & Transforms
(#195084)](https://github.com/elastic/kibana/pull/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":"92210485+rbrtj@users.noreply.github.com"},"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 <92210485+rbrtj@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-09 20:55:52 +11:00 committed by GitHub
parent 128dcb6b4f
commit b8d7596193
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 2 deletions

View file

@ -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';
@ -22,6 +22,8 @@ import {
const fixedPageSize: number = 20;
type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;
export const SourceSelection: FC = () => {
const {
services: {
@ -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
@ -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',

View file

@ -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;
@ -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',

View file

@ -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';
@ -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,
@ -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',

View file

@ -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 {
@ -19,6 +20,8 @@ interface SearchSelectionProps {
canEditDataView: boolean;
}
type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;
const fixedPageSize: number = 8;
export const SearchSelection: FC<SearchSelectionProps> = ({
@ -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',