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

[7.x] Removed Alerting & Event Log deprecated fields that should not be using (#85652) #85897

Merged
merged 2 commits into from
Dec 15, 2020
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
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
11 changes: 5 additions & 6 deletions x-pack/plugins/event_log/server/es/cluster_client_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import { Subject } from 'rxjs';
import { bufferTime, filter, switchMap } from 'rxjs/operators';
import { reject, isUndefined } from 'lodash';
import { SearchResponse, Client } from 'elasticsearch';
import { Client } from 'elasticsearch';
import type { PublicMethodsOf } from '@kbn/utility-types';
import { Logger, LegacyClusterClient } from 'src/core/server';
import { ESSearchResponse } from '../../../../typings/elasticsearch';
import { EsContext } from '.';
import { IEvent, IValidatedEvent, SAVED_OBJECT_REL_PRIMARY } from '../types';
import { FindOptionsType } from '../event_log_client';
Expand Down Expand Up @@ -284,17 +285,15 @@ export class ClusterClientAdapter {
try {
const {
hits: { hits, total },
}: SearchResponse<unknown> = await this.callEs('search', {
}: ESSearchResponse<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.value,
data: hits.map((hit) => hit._source) as IValidatedEvent[],
};
} catch (err) {
Expand Down