Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Modifying Alerting search detector query to bool query #200

Merged
merged 1 commit into from
Oct 23, 2020
Merged
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
6 changes: 3 additions & 3 deletions server/services/AnomalyDetectorService.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class DestinationsService {

getDetectors = async (req, h) => {
const searchRequest = {
query: { match_all: {} },
query: { bool: {} },
size: MAX_DETECTOR_COUNT,
};
const { callWithRequest } = this.esDriver.getCluster(CLUSTER.AD_ALERTING);
Expand All @@ -54,7 +54,7 @@ export default class DestinationsService {
});

const totalDetectors = resp.hits.total.value;
const detectors = resp.hits.hits.map(hit => {
const detectors = resp.hits.hits.map((hit) => {
const {
_source: detector,
_id: id,
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class DestinationsService {
const anomaliesResponse = await callWithRequest(req, 'alertingAD.searchResults', {
body: requestBody,
});
const transformedKeys = get(anomaliesResponse, 'hits.hits', []).map(result =>
const transformedKeys = get(anomaliesResponse, 'hits.hits', []).map((result) =>
mapKeysDeep(result._source, toCamel)
);
return {
Expand Down