Skip to content

Commit

Permalink
replace should with a single lower bounded and upper bounded date ran…
Browse files Browse the repository at this point in the history
…ge filter
  • Loading branch information
dhurley14 committed Jan 5, 2021
1 parent 284f422 commit 477682b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down Expand Up @@ -118,33 +97,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down Expand Up @@ -199,33 +157,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down Expand Up @@ -281,33 +218,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down Expand Up @@ -362,33 +278,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down Expand Up @@ -445,33 +340,12 @@ describe('create_signals', () => {
bool: {
filter: [
{
bool: {
should: [
{
range: {
'@timestamp': {
gte: 'now-5m',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
'@timestamp': {
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
range: {
'@timestamp': {
gte: 'now-5m',
lte: 'today',
format: 'strict_date_optional_time',
},
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,14 @@ export const buildEventsSearchQuery = ({
: '@timestamp';

const rangeFilter: unknown[] = [
{
bool: {
should: [
{
range: {
[sortField]: {
gte: from,
format: 'strict_date_optional_time',
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{
range: {
[sortField]: {
lte: to,
gte: from,
format: 'strict_date_optional_time',
},
},
Expand Down

0 comments on commit 477682b

Please sign in to comment.