Skip to content

Commit d267a42

Browse files
[8.19] [Synthetics] Fix text search for overview monitors !! (#229317) (#229505)
# Backport This will backport the following commits from `main` to `8.19`: - [[Synthetics] Fix text search for overview monitors !! (#229317)](#229317) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-07-25T17:40:11Z","message":"[Synthetics] Fix text search for overview monitors !! (#229317)\n\n## Summary\n\nFix text search for overview monitors !!\n\n\n### Before\n\nUsing * chars wasn't working in overview list\n\n<img width=\"1728\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0d907792-8cdb-419a-a740-c3a311f2304c\"\n/>\n\n\n\n### After\n\n<img width=\"1727\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1ad472c9-6613-4e22-9625-d076e1597185\"\n/>","sha":"11879e2c9952cb4555633217d37542fbc759beb5","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.2.0","v8.18.5"],"title":"[Synthetics] Fix text search for overview monitors !!","number":229317,"url":"https://github.com/elastic/kibana/pull/229317","mergeCommit":{"message":"[Synthetics] Fix text search for overview monitors !! (#229317)\n\n## Summary\n\nFix text search for overview monitors !!\n\n\n### Before\n\nUsing * chars wasn't working in overview list\n\n<img width=\"1728\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0d907792-8cdb-419a-a740-c3a311f2304c\"\n/>\n\n\n\n### After\n\n<img width=\"1727\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1ad472c9-6613-4e22-9625-d076e1597185\"\n/>","sha":"11879e2c9952cb4555633217d37542fbc759beb5"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19","8.18"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229317","number":229317,"mergeCommit":{"message":"[Synthetics] Fix text search for overview monitors !! (#229317)\n\n## Summary\n\nFix text search for overview monitors !!\n\n\n### Before\n\nUsing * chars wasn't working in overview list\n\n<img width=\"1728\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0d907792-8cdb-419a-a740-c3a311f2304c\"\n/>\n\n\n\n### After\n\n<img width=\"1727\" height=\"883\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1ad472c9-6613-4e22-9625-d076e1597185\"\n/>","sha":"11879e2c9952cb4555633217d37542fbc759beb5"}},{"branch":"8.18","label":"v8.18.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Shahzad <[email protected]>
1 parent b7b8a74 commit d267a42

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
lines changed

x-pack/solutions/observability/plugins/synthetics/server/routes/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const OverviewStatusSchema = schema.object({
6363

6464
export type OverviewStatusQuery = TypeOf<typeof OverviewStatusSchema>;
6565

66-
export const SEARCH_FIELDS = [
66+
export const MONITOR_SEARCH_FIELDS = [
6767
'name',
6868
'tags.text',
6969
'locations.id.text',

x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/get_monitors_list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
MonitorsQuery,
1515
parseMappingKey,
1616
QuerySchema,
17-
SEARCH_FIELDS,
17+
MONITOR_SEARCH_FIELDS,
1818
} from '../common';
1919

2020
export const getAllSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => ({
@@ -46,7 +46,7 @@ export const getAllSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () =>
4646
page: queryParams.page ?? 1,
4747
sortField: parseMappingKey(queryParams.sortField),
4848
sortOrder: queryParams.sortOrder,
49-
searchFields: SEARCH_FIELDS,
49+
searchFields: MONITOR_SEARCH_FIELDS,
5050
search: queryParams.query,
5151
filter: filtersStr,
5252
searchAfter: queryParams.searchAfter,

x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/project_monitor/get_monitor_project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { syntheticsMonitorSavedObjectType } from '../../../../common/types/saved
99
import { SyntheticsRestApiRouteFactory } from '../../types';
1010
import { ConfigKey, EncryptedSyntheticsMonitorAttributes } from '../../../../common/runtime_types';
1111
import { SYNTHETICS_API_URLS } from '../../../../common/constants';
12-
import { SEARCH_FIELDS } from '../../common';
12+
import { MONITOR_SEARCH_FIELDS } from '../../common';
1313

1414
const querySchema = schema.object({
1515
search_after: schema.maybe(schema.string()),
@@ -41,7 +41,7 @@ export const getSyntheticsProjectMonitorsRoute: SyntheticsRestApiRouteFactory =
4141
const { saved_objects: monitors, total } =
4242
await monitorConfigRepository.find<EncryptedSyntheticsMonitorAttributes>({
4343
perPage,
44-
searchFields: SEARCH_FIELDS,
44+
searchFields: MONITOR_SEARCH_FIELDS,
4545
fields: [ConfigKey.JOURNEY_ID, ConfigKey.CONFIG_HASH],
4646
filter: `${syntheticsMonitorSavedObjectType}.attributes.${ConfigKey.PROJECT_ID}: "${decodedProjectName}"`,
4747
sortField: ConfigKey.JOURNEY_ID,

x-pack/solutions/observability/plugins/synthetics/server/routes/overview_status/overview_status_service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export class OverviewStatusService {
338338
EncryptedSyntheticsMonitorAttributes & { [ConfigKey.URLS]?: string }
339339
>({
340340
showFromAllSpaces,
341-
search: query ? `${query}*` : '',
341+
search: query,
342342
filter: filtersStr,
343343
fields: [
344344
ConfigKey.ENABLED,

x-pack/solutions/observability/plugins/synthetics/server/routes/suggestions/suggestions_route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
EncryptedSyntheticsMonitorAttributes,
1818
} from '../../../common/runtime_types';
1919
import { SYNTHETICS_API_URLS } from '../../../common/constants';
20-
import { QuerySchema, getMonitorFilters, SEARCH_FIELDS } from '../common';
20+
import { QuerySchema, getMonitorFilters, MONITOR_SEARCH_FIELDS } from '../common';
2121
import { getAllLocations } from '../../synthetics_service/get_all_locations';
2222

2323
type Buckets = Array<{
@@ -178,7 +178,7 @@ export const getSyntheticsSuggestionsRoute: SyntheticsRestApiRouteFactory<
178178
filter: filtersStr ? filtersStr : undefined,
179179
aggs: getAggs(false),
180180
search: query ? `${query}*` : undefined,
181-
searchFields: SEARCH_FIELDS,
181+
searchFields: MONITOR_SEARCH_FIELDS,
182182
});
183183

184184
const { filtersStr: legacyFilterStr } = await getMonitorFilters(route, legacyMonitorAttributes);
@@ -190,7 +190,7 @@ export const getSyntheticsSuggestionsRoute: SyntheticsRestApiRouteFactory<
190190
filter: legacyFilterStr ? legacyFilterStr : undefined,
191191
aggs: getAggs(true),
192192
search: query ? `${query}*` : undefined,
193-
searchFields: SEARCH_FIELDS,
193+
searchFields: MONITOR_SEARCH_FIELDS,
194194
});
195195

196196
// Extract aggs

x-pack/solutions/observability/plugins/synthetics/server/services/monitor_config_repository.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
syntheticsMonitorAttributes,
2222
syntheticsMonitorSavedObjectType,
2323
} from '../../common/types/saved_objects';
24+
import { MONITOR_SEARCH_FIELDS } from '../routes/common';
2425

2526
// Mock the utils functions
2627
jest.mock('../synthetics_service/utils', () => ({
@@ -811,6 +812,7 @@ describe('MonitorConfigRepository', () => {
811812
search: 'test',
812813
sortField: 'name.keyword',
813814
sortOrder: 'asc',
815+
searchFields: MONITOR_SEARCH_FIELDS,
814816
});
815817
});
816818

@@ -838,6 +840,7 @@ describe('MonitorConfigRepository', () => {
838840
search: 'test',
839841
sortField: 'name.keyword',
840842
sortOrder: 'asc',
843+
searchFields: MONITOR_SEARCH_FIELDS,
841844
});
842845
});
843846

x-pack/solutions/observability/plugins/synthetics/server/services/monitor_config_repository.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin
1818
import { withApmSpan } from '@kbn/apm-data-access-plugin/server/utils/with_apm_span';
1919
import { isEmpty, isEqual } from 'lodash';
2020
import { Logger } from '@kbn/logging';
21+
import { MONITOR_SEARCH_FIELDS } from '../routes/common';
2122
import {
2223
legacyMonitorAttributes,
2324
legacySyntheticsMonitorTypeSingle,
@@ -339,7 +340,7 @@ export class MonitorConfigRepository {
339340
filter,
340341
sortField = 'name.keyword',
341342
sortOrder = 'asc',
342-
searchFields,
343+
searchFields = MONITOR_SEARCH_FIELDS,
343344
showFromAllSpaces,
344345
}: {
345346
search?: string;

0 commit comments

Comments
 (0)