Skip to content

Commit b7d0be0

Browse files
committed
Format bool queries
1 parent 23b8631 commit b7d0be0

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

x-pack/plugins/apm/public/components/shared/KueryBar/get_bool_filter.js

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,37 @@ export function getBoolFilter(urlParams) {
2727

2828
if (urlParams.serviceName) {
2929
boolFilter.push({
30-
term: {
31-
[SERVICE_NAME]: urlParams.serviceName
32-
}
30+
term: { [SERVICE_NAME]: urlParams.serviceName }
3331
});
3432
}
3533

3634
switch (urlParams.processorEvent) {
3735
case 'transaction':
3836
boolFilter.push({
39-
term: {
40-
[PROCESSOR_EVENT]: 'transaction'
41-
}
37+
term: { [PROCESSOR_EVENT]: 'transaction' }
4238
});
4339

4440
if (urlParams.transactionName) {
4541
boolFilter.push({
46-
term: {
47-
[`${TRANSACTION_NAME}.keyword`]: urlParams.transactionName
48-
}
42+
term: { [`${TRANSACTION_NAME}.keyword`]: urlParams.transactionName }
4943
});
5044
}
5145

5246
if (urlParams.transactionType) {
5347
boolFilter.push({
54-
term: {
55-
[TRANSACTION_TYPE]: urlParams.transactionType
56-
}
48+
term: { [TRANSACTION_TYPE]: urlParams.transactionType }
5749
});
5850
}
5951
break;
6052

6153
case 'error':
6254
boolFilter.push({
63-
term: {
64-
'processor.event': 'error'
65-
}
55+
term: { [PROCESSOR_EVENT]: 'error' }
6656
});
6757

6858
if (urlParams.errorGroupId) {
6959
boolFilter.push({
70-
term: {
71-
[ERROR_GROUP_ID]: urlParams.errorGroupId
72-
}
60+
term: { [ERROR_GROUP_ID]: urlParams.errorGroupId }
7361
});
7462
}
7563
break;
@@ -78,16 +66,8 @@ export function getBoolFilter(urlParams) {
7866
boolFilter.push({
7967
bool: {
8068
should: [
81-
{
82-
term: {
83-
'processor.event': 'error'
84-
}
85-
},
86-
{
87-
term: {
88-
'processor.event': 'transaction'
89-
}
90-
}
69+
{ term: { [PROCESSOR_EVENT]: 'error' } },
70+
{ term: { [PROCESSOR_EVENT]: 'transaction' } }
9171
]
9272
}
9373
});

0 commit comments

Comments
 (0)