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
2 changes: 1 addition & 1 deletion config/serverless.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ xpack.observabilityAiAssistantManagement.visibilityEnabled: false
xpack.searchSynonyms.enabled: true

# Query Rules UI
xpack.searchQueryRules.enabled: false
xpack.searchQueryRules.enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const applicationUsageSchema = {
searchInferenceEndpoints: commonSchema,
searchPlayground: commonSchema,
searchSynonyms: commonSchema,
searchQueryRules: commonSchema,
enterpriseSearchAnalytics: commonSchema,
enterpriseSearchApplications: commonSchema,
enterpriseSearchAISearch: commonSchema,
Expand Down
131 changes: 131 additions & 0 deletions src/platform/plugins/shared/telemetry/schema/oss_platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,137 @@
}
}
},
"searchQueryRules": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "Always `main`"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 90 days"
}
},
"views": {
"type": "array",
"items": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "The application view being tracked"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application sub view since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application sub view is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
}
}
}
}
}
}
},
"enterpriseSearchAnalytics": {
"properties": {
"appId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"features",
],
"optionalPlugins": [
"cloud",
"console",
"searchNavigation",
"share",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ import { CreateRulesetModal } from './create_ruleset_modal';
import { QueryRulesPageTemplate } from '../../layout/query_rules_page_template';
import { useUsageTracker } from '../../hooks/use_usage_tracker';
import { AnalyticsEvents } from '../../analytics/constants';
import { useQueryRulesBreadcrumbs } from '../../hooks/use_query_rules_breadcrumbs';

export const QueryRulesOverview = () => {
const usageTracker = useUsageTracker();
const { colorMode } = useEuiTheme();
useQueryRulesBreadcrumbs();

const { data: queryRulesData, isInitialLoading, isError, error } = useFetchQueryRulesSets();
const [isCreateModalVisible, setIsCreateModalVisible] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { useQueryRulesetDetailState } from './use_query_ruleset_detail_state';
import { useFetchQueryRulesetExist } from '../../hooks/use_fetch_ruleset_exists';
import { AnalyticsEvents } from '../../analytics/constants';
import { useUsageTracker } from '../../hooks/use_usage_tracker';
import { useQueryRulesBreadcrumbs } from '../../hooks/use_query_rules_breadcrumbs';

export interface QueryRulesetDetailProps {
createMode?: boolean;
Expand All @@ -55,6 +56,7 @@ export const QueryRulesetDetail: React.FC<QueryRulesetDetailProps> = ({ createMo
const { rulesetId = '' } = useParams<{
rulesetId?: string;
}>();
useQueryRulesBreadcrumbs(rulesetId);
const { data: rulesetExists, isLoading: isFailsafeLoading } =
useFetchQueryRulesetExist(rulesetId);
const useTracker = useUsageTracker();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { useEffect } from 'react';
import { i18n } from '@kbn/i18n';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import { useKibana } from './use_kibana';

const QUERY_RULES_BREADCRUMB_TEXT = i18n.translate(
'xpack.searchQueryRules.breadcrumbs.queryRules',
{
defaultMessage: 'Query Rules',
}
);

export const useQueryRulesBreadcrumbs = (rulesetId?: string) => {
const { searchNavigation, history, cloud } = useKibana().services;
const isServerless = cloud?.isServerlessEnabled ?? false;

useEffect(() => {
if (!isServerless) {
searchNavigation?.breadcrumbs.setSearchBreadCrumbs([
{
text: i18n.translate('xpack.searchQueryRules.breadcrumbs.relevance', {
defaultMessage: 'Relevance',
}),
},
...(rulesetId && rulesetId.trim().length > 0
? [
{
text: QUERY_RULES_BREADCRUMB_TEXT,
...reactRouterNavigate(history, '/'),
},
{
text: rulesetId,
},
]
: [
{
text: QUERY_RULES_BREADCRUMB_TEXT,
},
]),
]);
} else {
if (rulesetId && rulesetId.trim().length > 0) {
searchNavigation?.breadcrumbs.setSearchBreadCrumbs([
{
text: rulesetId,
},
]);
}
}

return () => {
// Clear breadcrumbs on unmount;
searchNavigation?.breadcrumbs.clearBreadcrumbs();
};
}, [searchNavigation, history, rulesetId, isServerless]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class QueryRulesPlugin
core: CoreSetup<AppPluginStartDependencies, SearchQueryRulesPluginStart>,
_: AppPluginSetupDependencies
): SearchQueryRulesPluginSetup {
if (!core.settings.client.get<boolean>(QUERY_RULES_UI_FLAG, false)) {
if (!core.settings.client.get<boolean>(QUERY_RULES_UI_FLAG, true)) {
return {};
}
core.application.register({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { AppMountParameters, CoreStart } from '@kbn/core/public';
import type { ConsolePluginStart } from '@kbn/console-plugin/public';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
import type { CloudStart } from '@kbn/cloud-plugin/public';

export * from '../common/types';
export interface AppPluginStartDependencies {
history: AppMountParameters['history'];
console?: ConsolePluginStart;
share?: SharePluginStart;
cloud?: CloudStart;
searchNavigation?: SearchNavigationPluginStart;
usageCollection?: UsageCollectionStart;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@kbn/deeplinks-analytics",
"@kbn/analytics",
"@kbn/usage-collection-plugin",
"@kbn/cloud-plugin",
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default function searchSolutionNavigation({
{ id: 'SearchApplications', label: 'Search Applications' },
{ id: 'BehavioralAnalytics', label: 'Behavioral Analytics' },
{ id: 'Relevance', label: 'Relevance' },
{ id: 'QueryRules', label: 'Query Rules' },
{ id: 'InferenceEndpoints', label: 'Inference Endpoints' },
{ id: 'Synonyms', label: 'Synonyms' },
{ id: 'GettingStarted', label: 'Getting started' },
Expand Down
2 changes: 2 additions & 0 deletions x-pack/test/functional_search/tests/solution_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function searchSolutionNavigation({
await solutionNavigation.sidenav.expectLinkExists({ text: 'Playground' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Search applications' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Behavioral Analytics' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Query Rules' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Inference Endpoints' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'App Search' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Workplace Search' });
Expand Down Expand Up @@ -295,6 +296,7 @@ export default function searchSolutionNavigation({
'build',
'searchPlayground',
'searchSynonyms:synonyms',
'searchQueryRules',
'enterpriseSearchApplications:searchApplications',
'enterpriseSearchAnalytics',
'relevance',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('../common/platform_security/roles.ts'));
loadTestFile(require.resolve('../common/spaces/multiple_spaces_enabled.ts'));
loadTestFile(require.resolve('./search_synonyms/search_synonyms_overview'));
loadTestFile(require.resolve('./search_query_rules/search_query_rules_overview'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./ml'));
loadTestFile(require.resolve('./custom_role_access'));
loadTestFile(require.resolve('./inference_management'));
loadTestFile(require.resolve('./search_query_rules/search_query_rules_overview'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await solutionNavigation.sidenav.expectLinkExists({ text: 'Relevance' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Inference Endpoints' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Synonyms' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Query Rules' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Analyze' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Discover' });
await solutionNavigation.sidenav.expectLinkExists({ text: 'Dashboards' });
Expand All @@ -287,6 +288,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
'dev_tools',
'searchPlayground',
'searchSynonyms',
'searchQueryRules',
'relevance',
'searchInferenceEndpoints',
'analyze',
Expand Down