mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[Response Ops] add ignore_malformed to alerts mappings AGAIN (#165781)
Resolves https://github.com/elastic/kibana/issues/161465 This is a re-do of https://github.com/elastic/kibana/pull/163414, which we had to revert since data streams do not support `ignore_malformed` on the `@timestamp` field. We now specifically add `ignore_malformed: false` for that field, and then use `ignore_malformed: true` at the index level. This ignores malformed content globally across all allowed mapping types. For existing alerts as data indices, the new setting is not applied directly to the existing concrete indices but will be applied whenever the alias rolls over and a new concrete index is created.
This commit is contained in:
parent
21034c12e7
commit
f638a38c64
9 changed files with 21 additions and 9 deletions
|
@ -188,6 +188,7 @@ describe('mappingFromFieldMap', () => {
|
||||||
dynamic: 'strict',
|
dynamic: 'strict',
|
||||||
properties: {
|
properties: {
|
||||||
'@timestamp': {
|
'@timestamp': {
|
||||||
|
ignore_malformed: false,
|
||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
event: {
|
event: {
|
||||||
|
|
|
@ -43,6 +43,10 @@ export function mappingFromFieldMap(
|
||||||
: rest;
|
: rest;
|
||||||
|
|
||||||
set(mappings.properties, field.name.split('.').join('.properties.'), mapped);
|
set(mappings.properties, field.name.split('.').join('.properties.'), mapped);
|
||||||
|
|
||||||
|
if (name === '@timestamp') {
|
||||||
|
set(mappings.properties, `${name}.ignore_malformed`, false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return mappings;
|
return mappings;
|
||||||
|
|
|
@ -141,6 +141,7 @@ const getIndexTemplatePutBody = (opts?: GetIndexTemplatePutBodyOpts) => {
|
||||||
rollover_alias: `.alerts-${context ? context : 'test'}.alerts-${namespace}`,
|
rollover_alias: `.alerts-${context ? context : 'test'}.alerts-${namespace}`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
'index.mapping.ignore_malformed': true,
|
||||||
'index.mapping.total_fields.limit': 2500,
|
'index.mapping.total_fields.limit': 2500,
|
||||||
},
|
},
|
||||||
mappings: {
|
mappings: {
|
||||||
|
@ -808,6 +809,7 @@ describe('Alerts Service', () => {
|
||||||
rollover_alias: `.alerts-empty.alerts-default`,
|
rollover_alias: `.alerts-empty.alerts-default`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
'index.mapping.ignore_malformed': true,
|
||||||
'index.mapping.total_fields.limit': 2500,
|
'index.mapping.total_fields.limit': 2500,
|
||||||
},
|
},
|
||||||
mappings: {
|
mappings: {
|
||||||
|
|
|
@ -48,6 +48,7 @@ const IndexTemplate = (namespace: string = 'default', useDataStream: boolean = f
|
||||||
rollover_alias: `.alerts-test.alerts-${namespace}`,
|
rollover_alias: `.alerts-test.alerts-${namespace}`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
'index.mapping.ignore_malformed': true,
|
||||||
'index.mapping.total_fields.limit': 2500,
|
'index.mapping.total_fields.limit': 2500,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,6 +68,7 @@ export const getIndexTemplate = ({
|
||||||
: {
|
: {
|
||||||
'index.lifecycle': indexLifecycle,
|
'index.lifecycle': indexLifecycle,
|
||||||
}),
|
}),
|
||||||
|
'index.mapping.ignore_malformed': true,
|
||||||
'index.mapping.total_fields.limit': totalFieldsLimit,
|
'index.mapping.total_fields.limit': totalFieldsLimit,
|
||||||
},
|
},
|
||||||
mappings: {
|
mappings: {
|
||||||
|
|
|
@ -175,6 +175,7 @@ describe('RiskEngineDataClient', () => {
|
||||||
"dynamic": "strict",
|
"dynamic": "strict",
|
||||||
"properties": Object {
|
"properties": Object {
|
||||||
"@timestamp": Object {
|
"@timestamp": Object {
|
||||||
|
"ignore_malformed": false,
|
||||||
"type": "date",
|
"type": "date",
|
||||||
},
|
},
|
||||||
"host": Object {
|
"host": Object {
|
||||||
|
@ -360,6 +361,7 @@ describe('RiskEngineDataClient', () => {
|
||||||
dynamic: 'strict',
|
dynamic: 'strict',
|
||||||
properties: {
|
properties: {
|
||||||
'@timestamp': {
|
'@timestamp': {
|
||||||
|
ignore_malformed: false,
|
||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
host: {
|
host: {
|
||||||
|
|
|
@ -163,6 +163,7 @@ export default function createAlertsAsDataInstallResourcesTest({ getService }: F
|
||||||
rollover_alias: '.alerts-test.patternfiring.alerts-default',
|
rollover_alias: '.alerts-test.patternfiring.alerts-default',
|
||||||
},
|
},
|
||||||
mapping: {
|
mapping: {
|
||||||
|
ignore_malformed: 'true',
|
||||||
total_fields: {
|
total_fields: {
|
||||||
limit: '2500',
|
limit: '2500',
|
||||||
},
|
},
|
||||||
|
@ -196,6 +197,7 @@ export default function createAlertsAsDataInstallResourcesTest({ getService }: F
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(contextIndex[indexName].settings?.index?.mapping).to.eql({
|
expect(contextIndex[indexName].settings?.index?.mapping).to.eql({
|
||||||
|
ignore_malformed: 'true',
|
||||||
total_fields: {
|
total_fields: {
|
||||||
limit: '2500',
|
limit: '2500',
|
||||||
},
|
},
|
||||||
|
|
|
@ -104,6 +104,7 @@ export default ({ getService }: FtrProviderContext) => {
|
||||||
dynamic: 'strict',
|
dynamic: 'strict',
|
||||||
properties: {
|
properties: {
|
||||||
'@timestamp': {
|
'@timestamp': {
|
||||||
|
ignore_malformed: false,
|
||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
host: {
|
host: {
|
||||||
|
|
|
@ -56,7 +56,6 @@ export default ({ getService }: FtrProviderContext) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/154277
|
|
||||||
describe('Non ECS fields in alert document source', () => {
|
describe('Non ECS fields in alert document source', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await esArchiver.load(
|
await esArchiver.load(
|
||||||
|
@ -257,9 +256,10 @@ export default ({ getService }: FtrProviderContext) => {
|
||||||
expect(alertSource).toHaveProperty('client.nat.port', '3000');
|
expect(alertSource).toHaveProperty('client.nat.port', '3000');
|
||||||
});
|
});
|
||||||
|
|
||||||
// we don't validate it because geo_point is very complex type with many various representations: array, different object, string with few valid patterns
|
// We don't validate it because geo_point is very complex type with many various representations: array,
|
||||||
// more on geo_point type https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html
|
// different object, string with few valid patterns.
|
||||||
it('should fail creating alert when ECS field mapping is geo_point', async () => {
|
// More on geo_point type https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html
|
||||||
|
it('should not fail creating alert when ECS field mapping is geo_point', async () => {
|
||||||
const document = {
|
const document = {
|
||||||
client: {
|
client: {
|
||||||
geo: {
|
geo: {
|
||||||
|
@ -269,12 +269,10 @@ export default ({ getService }: FtrProviderContext) => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const { errors } = await indexAndCreatePreviewAlert(document);
|
const { errors, alertSource } = await indexAndCreatePreviewAlert(document);
|
||||||
|
|
||||||
expect(errors[0]).toContain('Bulk Indexing of signals failed');
|
expect(errors).toEqual([]);
|
||||||
expect(errors[0]).toContain(
|
expect(alertSource).toHaveProperty('client.geo.location', 'test test');
|
||||||
'failed to parse field [client.geo.location] of type [geo_point]'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should strip invalid boolean values and left valid ones', async () => {
|
it('should strip invalid boolean values and left valid ones', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue