Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solutions] Fixes performance issue of track_total_hits not having an effect when used with search strategy #91068

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export const buildHostOverviewQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
...buildFieldsTermAggregation(esFields.filter((field) => !['@timestamp'].includes(field))),
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const buildHostsQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
aggregations: {
Expand Down Expand Up @@ -72,7 +73,6 @@ export const buildHostsQuery = ({
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const buildLastFirstSeenHostQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
aggregations: {
Expand All @@ -27,7 +28,6 @@ export const buildLastFirstSeenHostQuery = ({
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ export const formattedSearchStrategyResponse = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
docvalue_fields: mockOptions.docValueFields,
aggregations: {
Expand Down Expand Up @@ -656,7 +657,6 @@ export const formattedSearchStrategyResponse = {
},
},
size: 0,
track_total_hits: false,
},
},
null,
Expand Down Expand Up @@ -782,6 +782,7 @@ export const mockBuckets: HostAggEsItem = {

export const expectedDsl = {
allowNoIndices: true,
track_total_hits: false,
body: {
aggregations: {
host_count: { cardinality: { field: 'host.name' } },
Expand Down Expand Up @@ -817,7 +818,6 @@ export const expectedDsl = {
},
docvalue_fields: mockOptions.docValueFields,
size: 0,
track_total_hits: false,
},
ignoreUnavailable: true,
index: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const buildHostsQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
aggregations: {
Expand Down Expand Up @@ -71,7 +72,6 @@ export const buildHostsQuery = ({
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@ export const formattedSearchStrategyResponse = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
host_architecture: {
Expand Down Expand Up @@ -1387,7 +1388,6 @@ export const formattedSearchStrategyResponse = {
},
},
size: 0,
track_total_hits: false,
},
},
null,
Expand All @@ -1410,6 +1410,7 @@ export const expectedDsl = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
host_architecture: {
Expand Down Expand Up @@ -1645,6 +1646,5 @@ export const expectedDsl = {
},
},
size: 0,
track_total_hits: false,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export const buildHostDetailsQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
...buildFieldsTermAggregation(esFields.filter((field) => !['@timestamp'].includes(field))),
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const buildHostsKpiAuthenticationsQuery = ({
index: defaultIndex,
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggs: {
authentication_success: {
Expand Down Expand Up @@ -94,7 +95,6 @@ export const buildHostsKpiAuthenticationsQuery = ({
},
},
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const buildHostsKpiHostsQuery = ({
index: defaultIndex,
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
hosts: {
Expand Down Expand Up @@ -57,7 +58,6 @@ export const buildHostsKpiHostsQuery = ({
},
},
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const buildHostsKpiUniqueIpsQuery = ({
index: defaultIndex,
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
unique_source_ips: {
Expand Down Expand Up @@ -75,7 +76,6 @@ export const buildHostsKpiUniqueIpsQuery = ({
},
},
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ export const formattedSearchStrategyResponse = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
firstSeen: { min: { field: '@timestamp' } },
lastSeen: { max: { field: '@timestamp' } },
},
query: { bool: { filter: [{ term: { 'host.name': 'siem-kibana' } }] } },
size: 0,
track_total_hits: false,
},
},
null,
Expand All @@ -100,13 +100,13 @@ export const expectedDsl = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
firstSeen: { min: { field: '@timestamp' } },
lastSeen: { max: { field: '@timestamp' } },
},
query: { bool: { filter: [{ term: { 'host.name': 'siem-kibana' } }] } },
size: 0,
track_total_hits: false,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const buildFirstLastSeenHostQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
aggregations: {
Expand All @@ -28,7 +29,6 @@ export const buildFirstLastSeenHostQuery = ({
},
query: { bool: { filter } },
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const formattedSearchStrategyResponse = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
auditd_count: { filter: { term: { 'event.module': 'auditd' } } },
Expand Down Expand Up @@ -299,7 +300,6 @@ export const formattedSearchStrategyResponse = {
},
},
size: 0,
track_total_hits: false,
},
},
null,
Expand Down Expand Up @@ -339,6 +339,7 @@ export const expectedDsl = {
'winlogbeat-*',
],
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
auditd_count: { filter: { term: { 'event.module': 'auditd' } } },
Expand Down Expand Up @@ -511,6 +512,5 @@ export const expectedDsl = {
},
},
size: 0,
track_total_hits: false,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const buildOverviewHostQuery = ({
allowNoIndices: true,
index: defaultIndex,
ignoreUnavailable: true,
track_total_hits: false,
body: {
aggregations: {
auditd_count: {
Expand Down Expand Up @@ -289,7 +290,6 @@ export const buildOverviewHostQuery = ({
},
},
size: 0,
track_total_hits: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const formattedAlertsSearchStrategyResponse: MatrixHistogramStrategyRespo
],
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggregations: {
alertsGroup: {
Expand Down Expand Up @@ -113,7 +114,6 @@ export const formattedAlertsSearchStrategyResponse: MatrixHistogramStrategyRespo
},
},
size: 0,
track_total_hits: true,
},
},
null,
Expand All @@ -127,6 +127,7 @@ export const formattedAlertsSearchStrategyResponse: MatrixHistogramStrategyRespo

export const expectedDsl = {
allowNoIndices: true,
track_total_hits: false,
body: {
aggregations: {
host_count: { cardinality: { field: 'host.name' } },
Expand Down Expand Up @@ -161,7 +162,6 @@ export const expectedDsl = {
},
},
size: 0,
track_total_hits: false,
},
ignoreUnavailable: true,
index: [
Expand Down Expand Up @@ -208,6 +208,7 @@ export const formattedAnomaliesSearchStrategyResponse: MatrixHistogramStrategyRe
],
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggs: {
anomalyActionGroup: {
Expand Down Expand Up @@ -258,7 +259,6 @@ export const formattedAnomaliesSearchStrategyResponse: MatrixHistogramStrategyRe
},
},
size: 0,
track_total_hits: true,
},
},
null,
Expand Down Expand Up @@ -390,6 +390,7 @@ export const formattedAuthenticationsSearchStrategyResponse: MatrixHistogramStra
],
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggregations: {
eventActionGroup: {
Expand Down Expand Up @@ -429,7 +430,6 @@ export const formattedAuthenticationsSearchStrategyResponse: MatrixHistogramStra
},
},
size: 0,
track_total_hits: true,
},
},
null,
Expand Down Expand Up @@ -956,6 +956,7 @@ export const formattedEventsSearchStrategyResponse: MatrixHistogramStrategyRespo
],
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggregations: {
eventActionGroup: {
Expand Down Expand Up @@ -994,7 +995,6 @@ export const formattedEventsSearchStrategyResponse: MatrixHistogramStrategyRespo
},
},
size: 0,
track_total_hits: true,
},
},
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const expectedDsl = {
],
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggregations: {
alertsGroup: {
Expand Down Expand Up @@ -104,6 +105,5 @@ export const expectedDsl = {
},
},
size: 0,
track_total_hits: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const buildAlertsHistogramQuery = ({
index: defaultIndex,
allowNoIndices: true,
ignoreUnavailable: true,
track_total_hits: true,
body: {
aggregations: getHistogramAggregation(),
query: {
Expand All @@ -93,7 +94,6 @@ export const buildAlertsHistogramQuery = ({
},
},
size: 0,
track_total_hits: true,
},
};

Expand Down
Loading