Skip to content

Commit

Permalink
[aiops] Fix types.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Sep 15, 2022
1 parent 5c24e69 commit e7bf9b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import { chunk } from 'lodash';

import type { Query } from '@kbn/es-query';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import { i18n } from '@kbn/i18n';
import { asyncForEach } from '@kbn/std';
import type { IRouter } from '@kbn/core/server';
Expand Down Expand Up @@ -213,7 +214,7 @@ export const defineExplainLogRateSpikesRoute = (
const { fields, df } = await fetchFrequentItems(
client,
request.body.index,
JSON.parse(request.body.searchQuery) as Query['query'],
JSON.parse(request.body.searchQuery) as estypes.QueryDslQueryContainer,
changePoints,
request.body.timeFieldName,
request.body.deviationMin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { uniq, uniqWith, pick, isEqual } from 'lodash';

import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import type { Query } from '@kbn/es-query';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import type { ChangePoint } from '@kbn/ml-agg-utils';

Expand All @@ -26,7 +25,7 @@ function dropDuplicates(cp: ChangePoint[], uniqueFields: string[]) {
export async function fetchFrequentItems(
client: ElasticsearchClient,
index: string,
searchQuery: Query['query'],
searchQuery: estypes.QueryDslQueryContainer,
changePoints: ChangePoint[],
timeFieldName: string,
deviationMin: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import type { Query } from '@kbn/es-query';
import type { FieldValuePair } from '@kbn/ml-agg-utils';

import type { AiopsExplainLogRateSpikesSchema } from '../../../common/api/explain_log_rate_spikes';
Expand All @@ -23,7 +22,7 @@ interface QueryParams {
termFilters?: FieldValuePair[];
}
export const getQueryWithParams = ({ params, termFilters }: QueryParams) => {
const searchQuery = JSON.parse(params.searchQuery) as Query['query'];
const searchQuery = JSON.parse(params.searchQuery) as estypes.QueryDslQueryContainer;
return {
bool: {
filter: [
Expand Down

0 comments on commit e7bf9b9

Please sign in to comment.