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

[ML] Updated filtering in DetectionRulesIt.testCondition() #110628

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.logging.LogManager;
import org.elasticsearch.logging.Logger;
valeriy42 marked this conversation as resolved.
Show resolved Hide resolved
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
Expand Down Expand Up @@ -47,6 +49,9 @@
*/
public class DetectionRulesIT extends MlNativeAutodetectIntegTestCase {

// logger
public static final Logger logger = LogManager.getLogger(DetectionRulesIT.class);

valeriy42 marked this conversation as resolved.
Show resolved Hide resolved
@After
public void cleanUpTest() {
cleanUp();
Expand Down Expand Up @@ -95,6 +100,9 @@ public void testCondition() throws Exception {
closeJob(job.getId());

List<AnomalyRecord> records = getRecords(job.getId());
// remove records that are not anomalies
records.removeIf(record -> record.getInitialRecordScore() < 1e-5);

assertThat(records.size(), equalTo(1));
assertThat(records.get(0).getByFieldValue(), equalTo("high"));
long firstRecordTimestamp = records.get(0).getTimestamp().getTime();
Expand Down