Skip to content

Commit

Permalink
Removed Alerting & Event Log deprecated fields that should not be using
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Dec 10, 2020
1 parent b3706b1 commit 9c574d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/actions/server/usage/actions_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export async function getTotalCount(callCluster: LegacyAPICaller, kibanaIndex: s

const searchResult = await callCluster('search', {
index: kibanaIndex,
rest_total_hits_as_int: true,
body: {
query: {
bool: {
Expand Down Expand Up @@ -104,7 +103,6 @@ export async function getInUseTotalCount(callCluster: LegacyAPICaller, kibanaInd

const actionResults = await callCluster('search', {
index: kibanaIndex,
rest_total_hits_as_int: true,
body: {
query: {
bool: {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/alerts/server/usage/alerts_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export async function getTotalCountAggregations(callCluster: LegacyAPICaller, ki

const results = await callCluster('search', {
index: kibanaInex,
rest_total_hits_as_int: true,
body: {
query: {
bool: {
Expand Down Expand Up @@ -289,7 +288,6 @@ export async function getTotalCountAggregations(callCluster: LegacyAPICaller, ki
export async function getTotalCountInUse(callCluster: LegacyAPICaller, kibanaInex: string) {
const searchResult: SearchResponse<unknown> = await callCluster('search', {
index: kibanaInex,
rest_total_hits_as_int: true,
body: {
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ describe('queryEventsBySavedObject', () => {
},
},
"index": "index-name",
"rest_total_hits_as_int": true,
"track_total_hits": true,
}
`);
});
Expand Down Expand Up @@ -475,7 +475,7 @@ describe('queryEventsBySavedObject', () => {
},
},
"index": "index-name",
"rest_total_hits_as_int": true,
"track_total_hits": true,
}
`);
});
Expand Down Expand Up @@ -589,7 +589,7 @@ describe('queryEventsBySavedObject', () => {
},
},
"index": "index-name",
"rest_total_hits_as_int": true,
"track_total_hits": true,
}
`);
});
Expand Down Expand Up @@ -686,7 +686,7 @@ describe('queryEventsBySavedObject', () => {
},
},
"index": "index-name",
"rest_total_hits_as_int": true,
"track_total_hits": true,
}
`);
});
Expand Down
6 changes: 2 additions & 4 deletions x-pack/plugins/event_log/server/es/cluster_client_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,13 @@ export class ClusterClientAdapter {
hits: { hits, total },
}: SearchResponse<unknown> = await this.callEs('search', {
index,
// The SearchResponse type only supports total as an int,
// so we're forced to explicitly request that it return as an int
rest_total_hits_as_int: true,
track_total_hits: true,
body,
});
return {
page,
per_page: perPage,
total,
total: ((total as unknown) as { value: number; relation: string }).value || 0,
data: hits.map((hit) => hit._source) as IValidatedEvent[],
};
} catch (err) {
Expand Down

0 comments on commit 9c574d9

Please sign in to comment.