mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Co-authored-by: Patryk Kopyciński <patryk.kopycinski@elastic.co>
This commit is contained in:
parent
996f0ad10e
commit
1ba3dbcfcf
3 changed files with 50 additions and 1 deletions
|
@ -202,6 +202,20 @@ export const schema: FormSchema = {
|
|||
defaultMessage: 'Threshold',
|
||||
}
|
||||
),
|
||||
validations: [
|
||||
{
|
||||
validator: fieldValidators.numberGreaterThanField({
|
||||
than: 1,
|
||||
message: i18n.translate(
|
||||
'xpack.securitySolution.detectionEngine.validations.thresholdValueFieldData.numberGreaterThanOrEqualOneErrorMessage',
|
||||
{
|
||||
defaultMessage: 'Value must be greater than or equal one.',
|
||||
}
|
||||
),
|
||||
allowEquality: true,
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -193,4 +193,39 @@ describe('getThresholdSignalQueryFields', () => {
|
|||
'event.dataset': 'traefik.access',
|
||||
});
|
||||
});
|
||||
|
||||
it('should return proper object for exists filters', () => {
|
||||
const filters = {
|
||||
bool: {
|
||||
should: [
|
||||
{
|
||||
bool: {
|
||||
should: [
|
||||
{
|
||||
exists: {
|
||||
field: 'process.name',
|
||||
},
|
||||
},
|
||||
],
|
||||
minimum_should_match: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
bool: {
|
||||
should: [
|
||||
{
|
||||
exists: {
|
||||
field: 'event.type',
|
||||
},
|
||||
},
|
||||
],
|
||||
minimum_should_match: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
minimum_should_match: 1,
|
||||
},
|
||||
};
|
||||
expect(getThresholdSignalQueryFields(filters)).toEqual({});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ export const getThresholdSignalQueryFields = (filter: unknown) => {
|
|||
return { ...acc, ...item.match_phrase };
|
||||
}
|
||||
|
||||
if (item.bool.should && (item.bool.should[0].match || item.bool.should[0].match_phrase)) {
|
||||
if (item.bool?.should && (item.bool.should[0].match || item.bool.should[0].match_phrase)) {
|
||||
return { ...acc, ...(item.bool.should[0].match || item.bool.should[0].match_phrase) };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue