forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Get ML filters size should default to 100
When get filters is called without setting the `size` paramter only up to 10 filters are returned. However, 100 filters should be returned. This commit fixes this and adds an integ test to guard it. It seems this was accidentally broken in elastic#39976. Closes elastic#54206
- Loading branch information
1 parent
7e22ae4
commit d89ce57
Showing
4 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ve-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlFiltersIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ml.integration; | ||
|
||
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction; | ||
import org.elasticsearch.xpack.core.ml.job.config.MlFilter; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class MlFiltersIT extends MlNativeIntegTestCase { | ||
|
||
@Override | ||
protected void cleanUpResources() { | ||
// nothing to clean | ||
} | ||
|
||
public void testGetFilters_ShouldReturnUpTo100ByDefault() { | ||
int filtersCount = randomIntBetween(11, 100); | ||
for (int i = 0; i < filtersCount; i++) { | ||
putMlFilter(MlFilter.builder("filter-" + i).setItems("item-" + i).build()); | ||
} | ||
|
||
GetFiltersAction.Response filters = getMlFilters(); | ||
assertThat((int) filters.getFilters().count(), equalTo(filtersCount)); | ||
assertThat(filters.getFilters().results().size(), equalTo(filtersCount)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters