Skip to content

Commit

Permalink
Added bool filter with should
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Feb 18, 2021
1 parent 63784be commit 0f7c6c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getOr } from 'lodash/fp';

import { IEsSearchResponse } from '../../../../../../../../../src/plugins/data/common';
import {
HostAggEsData,
HostFirstLastSeenStrategyResponse,
HostsQueries,
HostFirstLastSeenRequestOptions,
Expand All @@ -23,7 +22,7 @@ export const firstSeenHost: SecuritySolutionFactory<HostsQueries.firstSeen> = {
buildDsl: (options: HostFirstLastSeenRequestOptions) => buildFirstOrLastSeenHostQuery(options),
parse: async (
options: HostFirstLastSeenRequestOptions,
response: IEsSearchResponse<HostAggEsData> // TODO: Change this response to match things better
response: IEsSearchResponse<unknown>
): Promise<HostFirstLastSeenStrategyResponse> => {
// First try to get the formatted field if it exists or not.
const formattedField: string | null = getOr(
Expand Down Expand Up @@ -51,7 +50,7 @@ export const lastSeenHost: SecuritySolutionFactory<HostsQueries.lastSeen> = {
buildDsl: (options: HostFirstLastSeenRequestOptions) => buildFirstOrLastSeenHostQuery(options),
parse: async (
options: HostFirstLastSeenRequestOptions,
response: IEsSearchResponse<HostAggEsData> // TODO: Change this response to match things better
response: IEsSearchResponse<unknown>
): Promise<HostFirstLastSeenStrategyResponse> => {
// First try to get the formatted field if it exists or not.
const formattedField: string | null = getOr(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const buildLastEventTimeQuery = ({
track_total_hits: false,
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
query: { bool: { should: getIpDetailsFilter(details.ip) } }, // TODO: Change this to use a bool filter
query: { bool: { filter: { bool: { should: getIpDetailsFilter(details.ip) } } } },
_source: ['@timestamp'],
size: 1,
sort: [
Expand Down

0 comments on commit 0f7c6c8

Please sign in to comment.