[SIEM] Adds example unit test to convert KQL using a nested query
## Summary Adds example unit test to convert KQL using a nested query ### Checklist - [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
This commit is contained in:
parent
a34a3a7e09
commit
effd504d0b
|
@ -462,6 +462,61 @@ describe('get_filter', () => {
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('it should work with a nested object queries', () => {
|
||||
const esQuery = getQueryFilter(
|
||||
'category:{ name:Frank and trusted:true }',
|
||||
'kuery',
|
||||
[],
|
||||
['auditbeat-*'],
|
||||
[]
|
||||
);
|
||||
expect(esQuery).toEqual({
|
||||
bool: {
|
||||
must: [],
|
||||
filter: [
|
||||
{
|
||||
nested: {
|
||||
path: 'category',
|
||||
query: {
|
||||
bool: {
|
||||
filter: [
|
||||
{
|
||||
bool: {
|
||||
should: [
|
||||
{
|
||||
match: {
|
||||
'category.name': 'Frank',
|
||||
},
|
||||
},
|
||||
],
|
||||
minimum_should_match: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
bool: {
|
||||
should: [
|
||||
{
|
||||
match: {
|
||||
'category.trusted': true,
|
||||
},
|
||||
},
|
||||
],
|
||||
minimum_should_match: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
score_mode: 'none',
|
||||
},
|
||||
},
|
||||
],
|
||||
should: [],
|
||||
must_not: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFilter', () => {
|
||||
|
|
Loading…
Reference in a new issue