Skip to content

Commit 73ac690

Browse files
committed
Rename FOR_CLUSTER_STATE and use INCLUDE_TYPE
1 parent 249c701 commit 73ac690

File tree

18 files changed

+58
-56
lines changed

18 files changed

+58
-56
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/MlMetaIndex.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ public final class MlMetaIndex {
2121
*/
2222
public static final String INDEX_NAME = ".ml-meta";
2323

24-
public static final String INCLUDE_TYPE_KEY = "include_type";
25-
2624
public static final String TYPE = "doc";
2725

2826
private MlMetaIndex() {}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/MlMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private static <T extends Writeable> void writeMap(Map<String, T> map, StreamOut
167167
@Override
168168
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
169169
DelegatingMapParams extendedParams =
170-
new DelegatingMapParams(Collections.singletonMap(ToXContentParams.FOR_CLUSTER_STATE, "true"), params);
170+
new DelegatingMapParams(Collections.singletonMap(ToXContentParams.FOR_INTERNAL_STORAGE, "true"), params);
171171
mapValuesToXContent(JOBS_FIELD, jobs, builder, extendedParams);
172172
mapValuesToXContent(DATAFEEDS_FIELD, datafeeds, builder, extendedParams);
173173
return builder;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/calendars/Calendar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.elasticsearch.common.xcontent.ObjectParser;
1414
import org.elasticsearch.common.xcontent.ToXContentObject;
1515
import org.elasticsearch.common.xcontent.XContentBuilder;
16-
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
16+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
1717

1818
import java.io.IOException;
1919
import java.util.Arrays;
@@ -111,7 +111,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
111111
if (description != null) {
112112
builder.field(DESCRIPTION.getPreferredName(), description);
113113
}
114-
if (params.paramAsBoolean(MlMetaIndex.INCLUDE_TYPE_KEY, false)) {
114+
if (params.paramAsBoolean(ToXContentParams.INCLUDE_TYPE, false)) {
115115
builder.field(TYPE.getPreferredName(), CALENDAR_TYPE);
116116
}
117117
builder.endObject();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/calendars/ScheduledEvent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
import org.elasticsearch.common.xcontent.ToXContentObject;
1616
import org.elasticsearch.common.xcontent.XContentBuilder;
1717
import org.elasticsearch.common.xcontent.XContentParser;
18-
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
1918
import org.elasticsearch.xpack.core.ml.job.config.DetectionRule;
2019
import org.elasticsearch.xpack.core.ml.job.config.Operator;
2120
import org.elasticsearch.xpack.core.ml.job.config.RuleAction;
2221
import org.elasticsearch.xpack.core.ml.job.config.RuleCondition;
2322
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
2423
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
2524
import org.elasticsearch.xpack.core.ml.utils.Intervals;
25+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
2626
import org.elasticsearch.xpack.core.ml.utils.time.TimeUtils;
2727

2828
import java.io.IOException;
@@ -170,7 +170,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
170170
if (eventId != null) {
171171
builder.field(EVENT_ID.getPreferredName(), eventId);
172172
}
173-
if (params.paramAsBoolean(MlMetaIndex.INCLUDE_TYPE_KEY, false)) {
173+
if (params.paramAsBoolean(ToXContentParams.INCLUDE_TYPE, false)) {
174174
builder.field(TYPE.getPreferredName(), SCHEDULED_EVENT_TYPE);
175175
}
176176
builder.endObject();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
322322
builder.startObject();
323323
builder.field(ID.getPreferredName(), id);
324324
builder.field(Job.ID.getPreferredName(), jobId);
325-
// Config type field is added for the migration to index documents
326-
// and isn't needed in cluster state configs. Not writing the field
327-
// protects against BWC issues.
328-
if (params.paramAsBoolean(ToXContentParams.FOR_CLUSTER_STATE, false) == false) {
325+
if (params.paramAsBoolean(ToXContentParams.INCLUDE_TYPE, false) == true) {
329326
builder.field(CONFIG_TYPE.getPreferredName(), TYPE);
330327
}
331328
builder.field(QUERY_DELAY.getPreferredName(), queryDelay.getStringRep());
@@ -349,7 +346,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
349346
if (chunkingConfig != null) {
350347
builder.field(CHUNKING_CONFIG.getPreferredName(), chunkingConfig);
351348
}
352-
if (headers.isEmpty() == false && params.paramAsBoolean(ToXContentParams.FOR_CLUSTER_STATE, false) == true) {
349+
if (headers.isEmpty() == false && params.paramAsBoolean(ToXContentParams.FOR_INTERNAL_STORAGE, false) == true) {
353350
builder.field(HEADERS.getPreferredName(), headers);
354351
}
355352
builder.endObject();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Detector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
315315
// negative means "unknown", which should only happen for a 5.4 job
316316
if (detectorIndex >= 0
317317
// no point writing this to cluster state, as the indexes will get reassigned on reload anyway
318-
&& params.paramAsBoolean(ToXContentParams.FOR_CLUSTER_STATE, false) == false) {
318+
&& params.paramAsBoolean(ToXContentParams.FOR_INTERNAL_STORAGE, false) == false) {
319319
builder.field(DETECTOR_INDEX.getPreferredName(), detectorIndex);
320320
}
321321
builder.endObject();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/MlFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import org.elasticsearch.common.xcontent.ObjectParser;
1515
import org.elasticsearch.common.xcontent.ToXContentObject;
1616
import org.elasticsearch.common.xcontent.XContentBuilder;
17-
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
1817
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
1918
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
2019
import org.elasticsearch.xpack.core.ml.utils.MlStrings;
20+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
2121

2222
import java.io.IOException;
2323
import java.util.Arrays;
@@ -101,7 +101,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
101101
builder.field(DESCRIPTION.getPreferredName(), description);
102102
}
103103
builder.field(ITEMS.getPreferredName(), items);
104-
if (params.paramAsBoolean(MlMetaIndex.INCLUDE_TYPE_KEY, false)) {
104+
if (params.paramAsBoolean(ToXContentParams.INCLUDE_TYPE, false)) {
105105
builder.field(TYPE.getPreferredName(), FILTER_TYPE);
106106
}
107107
builder.endObject();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/ToXContentParams.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@
1212
public final class ToXContentParams {
1313

1414
/**
15-
* Parameter to indicate whether we are serialising to X Content for cluster state output.
15+
* Parameter to indicate whether we are serialising to X Content for
16+
* internal storage. Certain fields need to be persisted but should
17+
* not be visible everywhere.
1618
*/
17-
public static final String FOR_CLUSTER_STATE = "for_cluster_state";
19+
public static final String FOR_INTERNAL_STORAGE = "for_internal_storage";
20+
21+
/**
22+
* When serialising POJOs to X Content this indicates whether the type field
23+
* should be included or not
24+
*/
25+
public static final String INCLUDE_TYPE = "include_type";
1826

1927
private ToXContentParams() {
2028
}

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfigTests.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static DatafeedConfig.Builder createRandomizedDatafeedConfigBuilder(Stri
113113
if (aggHistogramInterval == null) {
114114
builder.setFrequency(TimeValue.timeValueSeconds(randomIntBetween(1, 1_000_000)));
115115
} else {
116-
builder.setFrequency(TimeValue.timeValueMillis(randomIntBetween(1, 5) * aggHistogramInterval));
116+
builder.setFrequency(TimeValue.timeValueSeconds(randomIntBetween(1, 5) * aggHistogramInterval));
117117
}
118118
}
119119
if (randomBoolean()) {
@@ -180,7 +180,7 @@ public void testFutureMetadataParse() throws IOException {
180180
assertNotNull(DatafeedConfig.LENIENT_PARSER.apply(parser, null).build());
181181
}
182182

183-
public void testToXContentForClusterState() throws IOException {
183+
public void testToXContentForInternalStorage() throws IOException {
184184
DatafeedConfig.Builder builder = createRandomizedDatafeedConfigBuilder("foo", 300);
185185

186186
// headers are only persisted to cluster state
@@ -189,7 +189,7 @@ public void testToXContentForClusterState() throws IOException {
189189
builder.setHeaders(headers);
190190
DatafeedConfig config = builder.build();
191191

192-
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.FOR_CLUSTER_STATE, "true"));
192+
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.FOR_INTERNAL_STORAGE, "true"));
193193

194194
BytesReference forClusterstateXContent = XContentHelper.toXContent(config, XContentType.JSON, params, false);
195195
XContentParser parser = XContentFactory.xContent(XContentType.JSON)
@@ -198,19 +198,11 @@ public void testToXContentForClusterState() throws IOException {
198198
DatafeedConfig parsedConfig = DatafeedConfig.LENIENT_PARSER.apply(parser, null).build();
199199
assertThat(parsedConfig.getHeaders(), hasEntry("header-name", "header-value"));
200200

201-
// The config type field is not written to cluster state
202-
String configTypeEntry = "\""+DatafeedConfig.CONFIG_TYPE.getPreferredName()+"\":\""+DatafeedConfig.TYPE+"\"";
203-
assertThat(forClusterstateXContent.utf8ToString(), not(containsString(configTypeEntry)));
204-
205-
// headers are not written without the FOR_CLUSTER_STATE param
201+
// headers are not written without the FOR_INTERNAL_STORAGE param
206202
BytesReference nonClusterstateXContent = XContentHelper.toXContent(config, XContentType.JSON, ToXContent.EMPTY_PARAMS, false);
207203
parser = XContentFactory.xContent(XContentType.JSON)
208204
.createParser(xContentRegistry(), LoggingDeprecationHandler.INSTANCE, nonClusterstateXContent.streamInput());
209205

210-
211-
// The config type field should be present when the document is indexed
212-
assertThat(nonClusterstateXContent.utf8ToString(), containsString(configTypeEntry));
213-
214206
parsedConfig = DatafeedConfig.LENIENT_PARSER.apply(parser, null).build();
215207
assertThat(parsedConfig.getHeaders().entrySet(), hasSize(0));
216208
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportPostCalendarEventsAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.elasticsearch.xpack.core.ml.calendars.Calendar;
2828
import org.elasticsearch.xpack.core.ml.calendars.ScheduledEvent;
2929
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
30+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
3031
import org.elasticsearch.xpack.ml.job.JobManager;
3132
import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider;
3233

@@ -69,7 +70,7 @@ protected void doExecute(PostCalendarEventsAction.Request request,
6970
IndexRequest indexRequest = new IndexRequest(MlMetaIndex.INDEX_NAME, MlMetaIndex.TYPE);
7071
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
7172
indexRequest.source(event.toXContent(builder,
72-
new ToXContent.MapParams(Collections.singletonMap(MlMetaIndex.INCLUDE_TYPE_KEY,
73+
new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.INCLUDE_TYPE,
7374
"true"))));
7475
} catch (IOException e) {
7576
throw new IllegalStateException("Failed to serialise event", e);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportPutCalendarAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
2828
import org.elasticsearch.xpack.core.ml.calendars.Calendar;
2929
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
30+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
3031

3132
import java.io.IOException;
3233
import java.util.Collections;
@@ -55,7 +56,7 @@ protected void doExecute(PutCalendarAction.Request request, ActionListener<PutCa
5556
IndexRequest indexRequest = new IndexRequest(MlMetaIndex.INDEX_NAME, MlMetaIndex.TYPE, calendar.documentId());
5657
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
5758
indexRequest.source(calendar.toXContent(builder,
58-
new ToXContent.MapParams(Collections.singletonMap(MlMetaIndex.INCLUDE_TYPE_KEY, "true"))));
59+
new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.INCLUDE_TYPE, "true"))));
5960
} catch (IOException e) {
6061
throw new IllegalStateException("Failed to serialise calendar with id [" + calendar.getId() + "]", e);
6162
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportPutFilterAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.elasticsearch.xpack.core.ml.action.PutFilterAction;
2929
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;
3030
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
31+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
3132

3233
import java.io.IOException;
3334
import java.util.Collections;
@@ -55,7 +56,7 @@ protected void doExecute(PutFilterAction.Request request, ActionListener<PutFilt
5556
indexRequest.opType(DocWriteRequest.OpType.CREATE);
5657
indexRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
5758
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
58-
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(MlMetaIndex.INCLUDE_TYPE_KEY, "true"));
59+
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.INCLUDE_TYPE, "true"));
5960
indexRequest.source(filter.toXContent(builder, params));
6061
} catch (IOException e) {
6162
throw new IllegalStateException("Failed to serialise filter with id [" + filter.getId() + "]", e);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportUpdateFilterAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.elasticsearch.xpack.core.ml.job.config.MlFilter;
3838
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
3939
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
40+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
4041
import org.elasticsearch.xpack.ml.job.JobManager;
4142

4243
import java.io.IOException;
@@ -106,7 +107,7 @@ private void indexUpdatedFilter(MlFilter filter, long version, UpdateFilterActio
106107
indexRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
107108

108109
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
109-
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(MlMetaIndex.INCLUDE_TYPE_KEY, "true"));
110+
ToXContent.MapParams params = new ToXContent.MapParams(Collections.singletonMap(ToXContentParams.INCLUDE_TYPE, "true"));
110111
indexRequest.source(filter.toXContent(builder, params));
111112
} catch (IOException e) {
112113
throw new IllegalStateException("Failed to serialise filter with id [" + filter.getId() + "]", e);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/persistence/DatafeedConfigProvider.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.elasticsearch.action.search.SearchResponse;
2323
import org.elasticsearch.action.support.IndicesOptions;
2424
import org.elasticsearch.client.Client;
25+
import org.elasticsearch.common.Strings;
2526
import org.elasticsearch.common.bytes.BytesReference;
2627
import org.elasticsearch.common.component.AbstractComponent;
2728
import org.elasticsearch.common.regex.Regex;
@@ -45,11 +46,13 @@
4546
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
4647
import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings;
4748
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
49+
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
4850
import org.elasticsearch.xpack.ml.job.persistence.ExpandedIdsMatcher;
4951

5052
import java.io.IOException;
5153
import java.io.InputStream;
5254
import java.util.ArrayList;
55+
import java.util.HashMap;
5356
import java.util.HashSet;
5457
import java.util.List;
5558
import java.util.Map;
@@ -63,6 +66,12 @@ public class DatafeedConfigProvider extends AbstractComponent {
6366
private final Client client;
6467
private final NamedXContentRegistry xContentRegistry;
6568

69+
private static final Map<String, String> TO_XCONTENT_PARAMS = new HashMap<>();
70+
static {
71+
TO_XCONTENT_PARAMS.put(ToXContentParams.FOR_INTERNAL_STORAGE, "true");
72+
TO_XCONTENT_PARAMS.put(ToXContentParams.INCLUDE_TYPE, "true");
73+
}
74+
6675
public DatafeedConfigProvider(Client client, Settings settings, NamedXContentRegistry xContentRegistry) {
6776
super(settings);
6877
this.client = client;
@@ -79,7 +88,8 @@ public DatafeedConfigProvider(Client client, Settings settings, NamedXContentReg
7988
*/
8089
public void putDatafeedConfig(DatafeedConfig config, ActionListener<IndexResponse> listener) {
8190
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
82-
XContentBuilder source = config.toXContent(builder, ToXContent.EMPTY_PARAMS);
91+
XContentBuilder source = config.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS));
92+
8393
IndexRequest indexRequest = client.prepareIndex(AnomalyDetectorsIndex.configIndexName(),
8494
ElasticsearchMappings.DOC_TYPE, DatafeedConfig.documentId(config.getId()))
8595
.setSource(source)
@@ -334,7 +344,7 @@ public void expandDatafeedConfigs(String expression, boolean allowNoDatafeeds, A
334344

335345
private QueryBuilder buildQuery(String [] tokens) {
336346
QueryBuilder jobQuery = new TermQueryBuilder(DatafeedConfig.CONFIG_TYPE.getPreferredName(), DatafeedConfig.TYPE);
337-
if (ExpandedIdsMatcher.isWildcardAll(tokens)) {
347+
if (Strings.isAllOrWildcard(tokens)) {
338348
// match all
339349
return jobQuery;
340350
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/ExpandedIdsMatcher.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,6 @@ public final class ExpandedIdsMatcher {
3232

3333
public static String ALL = "_all";
3434

35-
/**
36-
* Does the {@code tokens} array resolves to a wildcard all expression.
37-
* True if {@code tokens} is empty or if it contains a single element
38-
* equal to {@link #ALL}, '*' or an empty string
39-
*
40-
* @param tokens Expression tokens
41-
* @return True if tokens resolves to a wildcard all expression
42-
*/
43-
public static boolean isWildcardAll(String [] tokens) {
44-
if (tokens.length == 0) {
45-
return true;
46-
}
47-
return tokens.length == 1 && (ALL.equals(tokens[0]) || Regex.isMatchAllPattern(tokens[0]) || tokens[0].isEmpty());
48-
}
49-
5035
/**
5136
* Split {@code expression} into tokens separated by a ','
5237
*
@@ -71,7 +56,7 @@ public static boolean isWildcardAll(String [] tokens) {
7156
public ExpandedIdsMatcher(String [] tokens, boolean allowNoMatchForWildcards) {
7257
requiredMatches = new LinkedList<>();
7358

74-
if (ExpandedIdsMatcher.isWildcardAll(tokens)) {
59+
if (Strings.isAllOrWildcard(tokens)) {
7560
// if allowNoJobForWildcards == true then any number
7661
// of jobs with any id is ok. Therefore no matches
7762
// are required

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobConfigProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.elasticsearch.action.search.SearchResponse;
2323
import org.elasticsearch.action.support.IndicesOptions;
2424
import org.elasticsearch.client.Client;
25+
import org.elasticsearch.common.Strings;
2526
import org.elasticsearch.common.bytes.BytesReference;
2627
import org.elasticsearch.common.component.AbstractComponent;
2728
import org.elasticsearch.common.regex.Regex;
@@ -370,7 +371,7 @@ private Job.Builder parseJobLenientlyFromSource(BytesReference source) throws IO
370371

371372
private QueryBuilder buildQuery(String [] tokens) {
372373
QueryBuilder jobQuery = new TermQueryBuilder(Job.JOB_TYPE.getPreferredName(), Job.ANOMALY_DETECTOR_JOB_TYPE);
373-
if (ExpandedIdsMatcher.isWildcardAll(tokens)) {
374+
if (Strings.isAllOrWildcard(tokens)) {
374375
// match all
375376
return jobQuery;
376377
}

0 commit comments

Comments
 (0)