Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
760f6b3
feat(fields-metadata): update types to match values from update
tonyghiani Dec 9, 2025
9245f61
refactor(fields-metadata): optimize bundle for cache key generation
tonyghiani Dec 9, 2025
80e6069
chore(fields-metadata): update elastic/ecs version
tonyghiani Dec 9, 2025
703f28b
feat(fields-metadata): update types to match values from update
tonyghiani Dec 9, 2025
1d164e0
chore(fields-metadata): remove unnecessary dependency
tonyghiani Dec 10, 2025
f46cb87
Changes from node scripts/capture_oas_snapshot --include-path /api/…
kibanamachine Dec 10, 2025
5e15b7f
Merge branch 'main' into feat/upgrade-elastic-ecs
tonyghiani Dec 10, 2025
8b1d86e
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Dec 30, 2025
430e3f5
update snapshots and chema
rStelmach Dec 30, 2025
6460c06
fix quick_checks
rStelmach Dec 30, 2025
c6372b4
update more tests
rStelmach Dec 30, 2025
cd4a9e8
update schemas
rStelmach Jan 5, 2026
38e63c5
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 5, 2026
ff3cbdb
add new elemtns to excluded types array
rStelmach Jan 5, 2026
1c8ebf6
update ecs schema and add helper function
rStelmach Jan 7, 2026
6a38c74
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 7, 2026
b2107d9
fix package.json
rStelmach Jan 7, 2026
aa551bf
fix package.json
rStelmach Jan 7, 2026
09cc407
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Jan 7, 2026
3b3e020
TO FIX: Run node 'scripts/check_pkg_json_semver_ranges && yarn kbn bo…
kibanamachine Jan 7, 2026
9cf2d22
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 7, 2026
ea1d2cc
add ingnore_above for event_original
rStelmach Jan 8, 2026
0560186
update schema
rStelmach Jan 8, 2026
0cb281d
increase ecs fields
rStelmach Jan 8, 2026
caa8d86
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 8, 2026
740f442
increase ecs fields, adjust field_formatter and maps_telmetry
rStelmach Jan 9, 2026
ccbbfc3
fix tests
rStelmach Jan 9, 2026
384d59c
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine Jan 10, 2026
bee5aa5
remove unused variable
rStelmach Jan 12, 2026
9608ce6
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 12, 2026
b8251b4
fix tests, add extra unit test
rStelmach Jan 13, 2026
3cb5e9b
update schema and snapshot
rStelmach Jan 14, 2026
adcb50b
regenerate schema
rStelmach Jan 14, 2026
acd8700
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 14, 2026
5275902
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 14, 2026
a0993d4
add comments
rStelmach Jan 21, 2026
f5b5809
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 21, 2026
35eba98
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 21, 2026
a118083
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 28, 2026
8299858
Merge remote-tracking branch 'upstream/main' into feat/upgrade-elasti…
rStelmach Jan 30, 2026
d422cce
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Jan 30, 2026
525552c
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Feb 2, 2026
af78a73
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Feb 5, 2026
c5c47c7
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Feb 5, 2026
213532c
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Feb 9, 2026
bc4d441
add 9.3.1 folder
rStelmach Feb 9, 2026
44e5fdc
add missing fields in cypress test
rStelmach Feb 10, 2026
6d9d97e
Merge branch 'main' into feat/upgrade-elastic-ecs
rStelmach Feb 11, 2026
98ec314
replace stringify package
rStelmach Feb 11, 2026
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@elastic/charts": "71.1.2",
"@elastic/datemath": "5.0.3",
"@elastic/ebt": "1.4.1",
"@elastic/ecs": "9.0.0",
"@elastic/ecs": "9.2.0",
"@elastic/elasticsearch": "9.2.0",
"@elastic/ems-client": "8.6.3",
"@elastic/eui": "112.3.0",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ import {
} from '@kbn/rule-data-utils';
import type { MultiField } from './types';

// ECS defines data_stream.* as constant_keyword, but alerts need them as regular keyword
// since constant_keyword is excluded from ecsFieldMap (causes composite mapping conflicts).
const DATA_STREAM_DATASET = 'data_stream.dataset' as const;
const DATA_STREAM_NAMESPACE = 'data_stream.namespace' as const;
const DATA_STREAM_TYPE = 'data_stream.type' as const;

export const alertFieldMap = {
[ALERT_ACTION_GROUP]: {
type: 'keyword',
Expand Down Expand Up @@ -284,6 +290,7 @@ export const alertFieldMap = {
type: 'unmapped',
required: false,
},
// ignore_above values must match ECS definitions to prevent composite mapping conflicts
[EVENT_ACTION]: {
type: 'keyword',
array: false,
Expand All @@ -296,21 +303,39 @@ export const alertFieldMap = {
required: false,
ignore_above: 1024,
},
// 32766 is Lucene's max term byte length - prevents "immense term" indexing errors
[EVENT_ORIGINAL]: {
type: 'keyword',
array: false,
required: false,
ignore_above: 1024,
ignore_above: 32766,
},
[DATA_STREAM_TYPE]: {
type: 'keyword',
array: false,
required: false,
},
[DATA_STREAM_DATASET]: {
type: 'keyword',
array: false,
required: false,
},
[DATA_STREAM_NAMESPACE]: {
type: 'keyword',
array: false,
required: false,
},
[SPACE_IDS]: {
type: 'keyword',
array: true,
required: true,
},
// ignore_above: 1024 matches ECS definition to prevent composite mapping conflicts
[TAGS]: {
type: 'keyword',
array: true,
required: false,
ignore_above: 1024,
},
[TIMESTAMP]: {
type: 'date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import { EcsFlat } from '@elastic/ecs';
import type { EcsMetadata, FieldMap } from './types';

const EXCLUDED_TYPES = ['constant_keyword'];
// These field types cause Elasticsearch "invalid composite mappings" errors when composing
// index templates. constant_keyword conflicts with keyword overrides, while nested/flattened
// types cannot be mixed with object mappings in component template composition.
const EXCLUDED_TYPES = ['constant_keyword', 'nested', 'flattened'];

// ECS fields that have reached Stage 2 in the RFC process
// are included in the generated Yaml but are still considered
Expand Down Expand Up @@ -48,10 +51,24 @@ const EXPERIMENTAL_FIELDS = [
'process.io.bytes',
];

// Child fields of excluded parent types must also be excluded to prevent mapping conflicts.
// E.g., if threat.enrichments is nested, all threat.enrichments.* children are also excluded.
const EXCLUDED_PARENT_PATHS = Object.entries(EcsFlat)
.filter(([_, value]) => EXCLUDED_TYPES.includes(value.type))
.map(([key]) => key + '.');

// Check if a field is a child of an excluded parent
const isChildOfExcludedParent = (fieldKey: string): boolean => {
return EXCLUDED_PARENT_PATHS.some((parentPath) => fieldKey.startsWith(parentPath));
};

export const ecsFieldMap: FieldMap = Object.fromEntries(
Object.entries(EcsFlat)
.filter(
([key, value]) => !EXCLUDED_TYPES.includes(value.type) && !EXPERIMENTAL_FIELDS.includes(key)
([key, value]) =>
!EXCLUDED_TYPES.includes(value.type) &&
!EXPERIMENTAL_FIELDS.includes(key) &&
!isChildOfExcludedParent(key)
)
.map(([key, _]) => {
const value: EcsMetadata = EcsFlat[key as keyof typeof EcsFlat];
Expand All @@ -70,3 +87,16 @@ export const ecsFieldMap: FieldMap = Object.fromEntries(
);

export type EcsFieldMap = typeof ecsFieldMap;

/**
* A Set containing the names of ECS fields that have type 'nested'.
* This is exported separately from ecsFieldMap because nested fields are excluded
* from ecsFieldMap to prevent Elasticsearch composite mapping conflicts, but some
* code (like traverseAndMutateDoc) still needs to know which fields are nested
* to properly validate alert documents.
*/
export const ecsNestedFieldNames: ReadonlySet<string> = new Set(
Object.entries(EcsFlat)
.filter(([_, value]) => value.type === 'nested')
.map(([key]) => key)
);
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export const legacyAlertFieldMap = {
type: 'keyword',
array: false,
required: false,
ignore_above: 1024,
},
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ const AlertRequired = rt.type({
});
// prettier-ignore
const AlertOptional = rt.partial({
'data_stream.dataset': schemaString,
'data_stream.namespace': schemaString,
'data_stream.type': schemaString,
'event.action': schemaString,
'event.kind': schemaString,
'event.original': schemaString,
Expand Down
Loading
Loading