Skip to content

Commit

Permalink
remove any
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Jan 20, 2022
1 parent c88762c commit 7cd7abb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions x-pack/plugins/ml/public/maps/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { FeatureCollection, Feature, Geometry } from 'geojson';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ESSearchResponse } from '../../../../../src/core/types/elasticsearch';
import { formatHumanReadableDateTimeSeconds } from '../../common/util/date_utils';
import type { MlApiServices } from '../application/services/ml_api_service';
Expand All @@ -31,11 +32,17 @@ export async function getResultsForJobId(
searchFilters: VectorSourceRequestMeta
): Promise<FeatureCollection> {
const { timeFilters } = searchFilters;

const must: estypes.QueryDslQueryContainer[] = [
{ term: { job_id: jobId } },
{ term: { result_type: 'record' } },
];

// Query to look for the highest scoring anomaly.
const body: any = {
const body: estypes.SearchRequest['body'] = {
query: {
bool: {
must: [{ term: { job_id: jobId } }, { term: { result_type: 'record' } }],
must,
},
},
size: 1000,
Expand All @@ -53,7 +60,7 @@ export async function getResultsForJobId(
},
},
};
body.query.bool.must.push(timerange);
must.push(timerange);
}

let resp: ESSearchResponse<MLAnomalyDoc> | null = null;
Expand Down

0 comments on commit 7cd7abb

Please sign in to comment.