Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Nov 6, 2020
1 parent 8d8db9c commit d0b282b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,23 @@ export const formattedSearchStrategyResponse = {
dns_name_query_count: {
terms: {
field: 'dns.question.registered_domain',
size: 10,
order: { unique_domains: 'desc' },
size: 1000000,
},
aggs: {
bucket_sort: {
bucket_sort: {
sort: [
{
unique_domains: {
order: 'desc',
},
},
{ _key: { order: 'asc' } },
],
from: 0,
size: 10,
},
},
unique_domains: { cardinality: { field: 'dns.question.name' } },
dns_bytes_in: { sum: { field: 'source.bytes' } },
dns_bytes_out: { sum: { field: 'destination.bytes' } },
Expand Down Expand Up @@ -204,10 +217,23 @@ export const expectedDsl = {
dns_name_query_count: {
terms: {
field: 'dns.question.registered_domain',
size: 10,
order: { unique_domains: 'desc' },
size: 1000000,
},
aggs: {
bucket_sort: {
bucket_sort: {
sort: [
{
unique_domains: {
order: 'desc',
},
},
{ _key: { order: 'asc' } },
],
from: 0,
size: 10,
},
},
unique_domains: { cardinality: { field: 'dns.question.name' } },
dns_bytes_in: { sum: { field: 'source.bytes' } },
dns_bytes_out: { sum: { field: 'destination.bytes' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ type QueryOrder =
const getQueryOrder = (sort: SortField<NetworkDnsFields>): QueryOrder => {
switch (sort.field) {
case NetworkDnsFields.queryCount:
return {
_count: {
order: sort.direction,
},
};
return { _count: { order: sort.direction } };
case NetworkDnsFields.dnsName:
return { _key: { order: sort.direction } };
case NetworkDnsFields.uniqueDomains:
return { unique_domains: { order: sort.direction } };
case NetworkDnsFields.dnsBytesIn:
return { dns_bytes_in: { order: sort.direction } };
case NetworkDnsFields.dnsBytesOut:
return { dns_bytes_out: { order: sort.direction } };
}
assertUnreachable(sort.field);
};
Expand Down

0 comments on commit d0b282b

Please sign in to comment.