Skip to content

Commit 29ee3a0

Browse files
authored
Deprecate allow_no_jobs and allow_no_datafeeds in favor of allow_no_match (#60601)
1 parent 9b2e690 commit 29ee3a0

File tree

81 files changed

+680
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+680
-334
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ static Request getJob(GetJobRequest getJobRequest) {
120120
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
121121

122122
RequestConverters.Params params = new RequestConverters.Params();
123-
if (getJobRequest.getAllowNoJobs() != null) {
124-
params.putParam("allow_no_jobs", Boolean.toString(getJobRequest.getAllowNoJobs()));
123+
if (getJobRequest.getAllowNoMatch() != null) {
124+
params.putParam("allow_no_match", Boolean.toString(getJobRequest.getAllowNoMatch()));
125125
}
126126
request.addParameters(params.asMap());
127127
return request;
@@ -137,8 +137,8 @@ static Request getJobStats(GetJobStatsRequest getJobStatsRequest) {
137137
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
138138

139139
RequestConverters.Params params = new RequestConverters.Params();
140-
if (getJobStatsRequest.getAllowNoJobs() != null) {
141-
params.putParam("allow_no_jobs", Boolean.toString(getJobStatsRequest.getAllowNoJobs()));
140+
if (getJobStatsRequest.getAllowNoMatch() != null) {
141+
params.putParam("allow_no_match", Boolean.toString(getJobStatsRequest.getAllowNoMatch()));
142142
}
143143
request.addParameters(params.asMap());
144144
return request;
@@ -266,9 +266,9 @@ static Request getDatafeed(GetDatafeedRequest getDatafeedRequest) {
266266
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
267267

268268
RequestConverters.Params params = new RequestConverters.Params();
269-
if (getDatafeedRequest.getAllowNoDatafeeds() != null) {
270-
params.putParam(GetDatafeedRequest.ALLOW_NO_DATAFEEDS.getPreferredName(),
271-
Boolean.toString(getDatafeedRequest.getAllowNoDatafeeds()));
269+
if (getDatafeedRequest.getAllowNoMatch() != null) {
270+
params.putParam(GetDatafeedRequest.ALLOW_NO_MATCH.getPreferredName(),
271+
Boolean.toString(getDatafeedRequest.getAllowNoMatch()));
272272
}
273273
request.addParameters(params.asMap());
274274
return request;
@@ -323,8 +323,8 @@ static Request getDatafeedStats(GetDatafeedStatsRequest getDatafeedStatsRequest)
323323
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
324324

325325
RequestConverters.Params params = new RequestConverters.Params();
326-
if (getDatafeedStatsRequest.getAllowNoDatafeeds() != null) {
327-
params.putParam("allow_no_datafeeds", Boolean.toString(getDatafeedStatsRequest.getAllowNoDatafeeds()));
326+
if (getDatafeedStatsRequest.getAllowNoMatch() != null) {
327+
params.putParam("allow_no_match", Boolean.toString(getDatafeedStatsRequest.getAllowNoMatch()));
328328
}
329329
request.addParameters(params.asMap());
330330
return request;

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/CloseJobRequest.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class CloseJobRequest implements ToXContentObject, Validatable {
4242
public static final ParseField JOB_ID = new ParseField("job_id");
4343
public static final ParseField TIMEOUT = new ParseField("timeout");
4444
public static final ParseField FORCE = new ParseField("force");
45-
public static final ParseField ALLOW_NO_JOBS = new ParseField("allow_no_jobs");
45+
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
4646

4747
@SuppressWarnings("unchecked")
4848
public static final ConstructingObjectParser<CloseJobRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -55,15 +55,15 @@ public class CloseJobRequest implements ToXContentObject, Validatable {
5555
JOB_ID, ObjectParser.ValueType.STRING_ARRAY);
5656
PARSER.declareString((obj, val) -> obj.setTimeout(TimeValue.parseTimeValue(val, TIMEOUT.getPreferredName())), TIMEOUT);
5757
PARSER.declareBoolean(CloseJobRequest::setForce, FORCE);
58-
PARSER.declareBoolean(CloseJobRequest::setAllowNoJobs, ALLOW_NO_JOBS);
58+
PARSER.declareBoolean(CloseJobRequest::setAllowNoMatch, ALLOW_NO_MATCH);
5959
}
6060

6161
private static final String ALL_JOBS = "_all";
6262

6363
private final List<String> jobIds;
6464
private TimeValue timeout;
6565
private Boolean force;
66-
private Boolean allowNoJobs;
66+
private Boolean allowNoMatch;
6767

6868
/**
6969
* Explicitly close all jobs
@@ -128,24 +128,24 @@ public void setForce(boolean force) {
128128
this.force = force;
129129
}
130130

131-
public Boolean getAllowNoJobs() {
132-
return this.allowNoJobs;
131+
public Boolean getAllowNoMatch() {
132+
return this.allowNoMatch;
133133
}
134134

135135
/**
136136
* Whether to ignore if a wildcard expression matches no jobs.
137137
*
138138
* This includes {@code _all} string or when no jobs have been specified
139139
*
140-
* @param allowNoJobs When {@code true} ignore if wildcard or {@code _all} matches no jobs. Defaults to {@code true}
140+
* @param allowNoMatch When {@code true} ignore if wildcard or {@code _all} matches no jobs. Defaults to {@code true}
141141
*/
142-
public void setAllowNoJobs(boolean allowNoJobs) {
143-
this.allowNoJobs = allowNoJobs;
142+
public void setAllowNoMatch(boolean allowNoMatch) {
143+
this.allowNoMatch = allowNoMatch;
144144
}
145145

146146
@Override
147147
public int hashCode() {
148-
return Objects.hash(jobIds, timeout, force, allowNoJobs);
148+
return Objects.hash(jobIds, timeout, force, allowNoMatch);
149149
}
150150

151151
@Override
@@ -162,7 +162,7 @@ public boolean equals(Object other) {
162162
return Objects.equals(jobIds, that.jobIds) &&
163163
Objects.equals(timeout, that.timeout) &&
164164
Objects.equals(force, that.force) &&
165-
Objects.equals(allowNoJobs, that.allowNoJobs);
165+
Objects.equals(allowNoMatch, that.allowNoMatch);
166166
}
167167

168168
@Override
@@ -175,8 +175,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
175175
if (force != null) {
176176
builder.field(FORCE.getPreferredName(), force);
177177
}
178-
if (allowNoJobs != null) {
179-
builder.field(ALLOW_NO_JOBS.getPreferredName(), allowNoJobs);
178+
if (allowNoMatch != null) {
179+
builder.field(ALLOW_NO_MATCH.getPreferredName(), allowNoMatch);
180180
}
181181
builder.endObject();
182182
return builder;

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDatafeedRequest.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
public class GetDatafeedRequest implements Validatable, ToXContentObject {
4141

4242
public static final ParseField DATAFEED_IDS = new ParseField("datafeed_ids");
43-
public static final ParseField ALLOW_NO_DATAFEEDS = new ParseField("allow_no_datafeeds");
43+
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
4444

4545
private static final String ALL_DATAFEEDS = "_all";
4646
private final List<String> datafeedIds;
47-
private Boolean allowNoDatafeeds;
47+
private Boolean allowNoMatch;
4848

4949
@SuppressWarnings("unchecked")
5050
public static final ConstructingObjectParser<GetDatafeedRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -53,7 +53,7 @@ public class GetDatafeedRequest implements Validatable, ToXContentObject {
5353

5454
static {
5555
PARSER.declareStringArray(ConstructingObjectParser.optionalConstructorArg(), DATAFEED_IDS);
56-
PARSER.declareBoolean(GetDatafeedRequest::setAllowNoDatafeeds, ALLOW_NO_DATAFEEDS);
56+
PARSER.declareBoolean(GetDatafeedRequest::setAllowNoMatch, ALLOW_NO_MATCH);
5757
}
5858

5959
/**
@@ -89,20 +89,20 @@ public List<String> getDatafeedIds() {
8989
/**
9090
* Whether to ignore if a wildcard expression matches no datafeeds.
9191
*
92-
* @param allowNoDatafeeds If this is {@code false}, then an error is returned when a wildcard (or {@code _all})
92+
* @param allowNoMatch If this is {@code false}, then an error is returned when a wildcard (or {@code _all})
9393
* does not match any datafeeds
9494
*/
95-
public void setAllowNoDatafeeds(boolean allowNoDatafeeds) {
96-
this.allowNoDatafeeds = allowNoDatafeeds;
95+
public void setAllowNoMatch(boolean allowNoMatch) {
96+
this.allowNoMatch = allowNoMatch;
9797
}
9898

99-
public Boolean getAllowNoDatafeeds() {
100-
return allowNoDatafeeds;
99+
public Boolean getAllowNoMatch() {
100+
return allowNoMatch;
101101
}
102102

103103
@Override
104104
public int hashCode() {
105-
return Objects.hash(datafeedIds, allowNoDatafeeds);
105+
return Objects.hash(datafeedIds, allowNoMatch);
106106
}
107107

108108
@Override
@@ -117,7 +117,7 @@ public boolean equals(Object other) {
117117

118118
GetDatafeedRequest that = (GetDatafeedRequest) other;
119119
return Objects.equals(datafeedIds, that.datafeedIds) &&
120-
Objects.equals(allowNoDatafeeds, that.allowNoDatafeeds);
120+
Objects.equals(allowNoMatch, that.allowNoMatch);
121121
}
122122

123123
@Override
@@ -128,8 +128,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
128128
builder.field(DATAFEED_IDS.getPreferredName(), datafeedIds);
129129
}
130130

131-
if (allowNoDatafeeds != null) {
132-
builder.field(ALLOW_NO_DATAFEEDS.getPreferredName(), allowNoDatafeeds);
131+
if (allowNoMatch != null) {
132+
builder.field(ALLOW_NO_MATCH.getPreferredName(), allowNoMatch);
133133
}
134134

135135
builder.endObject();

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDatafeedStatsRequest.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*/
4343
public class GetDatafeedStatsRequest implements Validatable, ToXContentObject {
4444

45-
public static final ParseField ALLOW_NO_DATAFEEDS = new ParseField("allow_no_datafeeds");
45+
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
4646

4747
@SuppressWarnings("unchecked")
4848
public static final ConstructingObjectParser<GetDatafeedStatsRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -52,13 +52,13 @@ public class GetDatafeedStatsRequest implements Validatable, ToXContentObject {
5252
PARSER.declareField(ConstructingObjectParser.constructorArg(),
5353
p -> Arrays.asList(Strings.commaDelimitedListToStringArray(p.text())),
5454
DatafeedConfig.ID, ObjectParser.ValueType.STRING_ARRAY);
55-
PARSER.declareBoolean(GetDatafeedStatsRequest::setAllowNoDatafeeds, ALLOW_NO_DATAFEEDS);
55+
PARSER.declareBoolean(GetDatafeedStatsRequest::setAllowNoMatch, ALLOW_NO_MATCH);
5656
}
5757

5858
private static final String ALL_DATAFEEDS = "_all";
5959

6060
private final List<String> datafeedIds;
61-
private Boolean allowNoDatafeeds;
61+
private Boolean allowNoMatch;
6262

6363
/**
6464
* Explicitly gets all datafeeds statistics
@@ -92,24 +92,24 @@ public List<String> getDatafeedIds() {
9292
return datafeedIds;
9393
}
9494

95-
public Boolean getAllowNoDatafeeds() {
96-
return this.allowNoDatafeeds;
95+
public Boolean getAllowNoMatch() {
96+
return this.allowNoMatch;
9797
}
9898

9999
/**
100100
* Whether to ignore if a wildcard expression matches no datafeeds.
101101
*
102102
* This includes {@code _all} string or when no datafeeds have been specified
103103
*
104-
* @param allowNoDatafeeds When {@code true} ignore if wildcard or {@code _all} matches no datafeeds. Defaults to {@code true}
104+
* @param allowNoMatch When {@code true} ignore if wildcard or {@code _all} matches no datafeeds. Defaults to {@code true}
105105
*/
106-
public void setAllowNoDatafeeds(boolean allowNoDatafeeds) {
107-
this.allowNoDatafeeds = allowNoDatafeeds;
106+
public void setAllowNoMatch(boolean allowNoMatch) {
107+
this.allowNoMatch = allowNoMatch;
108108
}
109109

110110
@Override
111111
public int hashCode() {
112-
return Objects.hash(datafeedIds, allowNoDatafeeds);
112+
return Objects.hash(datafeedIds, allowNoMatch);
113113
}
114114

115115
@Override
@@ -124,15 +124,15 @@ public boolean equals(Object other) {
124124

125125
GetDatafeedStatsRequest that = (GetDatafeedStatsRequest) other;
126126
return Objects.equals(datafeedIds, that.datafeedIds) &&
127-
Objects.equals(allowNoDatafeeds, that.allowNoDatafeeds);
127+
Objects.equals(allowNoMatch, that.allowNoMatch);
128128
}
129129

130130
@Override
131131
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
132132
builder.startObject();
133133
builder.field(DatafeedConfig.ID.getPreferredName(), Strings.collectionToCommaDelimitedString(datafeedIds));
134-
if (allowNoDatafeeds != null) {
135-
builder.field(ALLOW_NO_DATAFEEDS.getPreferredName(), allowNoDatafeeds);
134+
if (allowNoMatch != null) {
135+
builder.field(ALLOW_NO_MATCH.getPreferredName(), allowNoMatch);
136136
}
137137
builder.endObject();
138138
return builder;

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetJobRequest.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
public class GetJobRequest implements Validatable, ToXContentObject {
4242

4343
public static final ParseField JOB_IDS = new ParseField("job_ids");
44-
public static final ParseField ALLOW_NO_JOBS = new ParseField("allow_no_jobs");
44+
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
4545

4646
private static final String ALL_JOBS = "_all";
4747
private final List<String> jobIds;
48-
private Boolean allowNoJobs;
48+
private Boolean allowNoMatch;
4949

5050
@SuppressWarnings("unchecked")
5151
public static final ConstructingObjectParser<GetJobRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -54,7 +54,7 @@ public class GetJobRequest implements Validatable, ToXContentObject {
5454

5555
static {
5656
PARSER.declareStringArray(ConstructingObjectParser.optionalConstructorArg(), JOB_IDS);
57-
PARSER.declareBoolean(GetJobRequest::setAllowNoJobs, ALLOW_NO_JOBS);
57+
PARSER.declareBoolean(GetJobRequest::setAllowNoMatch, ALLOW_NO_MATCH);
5858
}
5959

6060
/**
@@ -90,19 +90,19 @@ public List<String> getJobIds() {
9090
/**
9191
* Whether to ignore if a wildcard expression matches no jobs.
9292
*
93-
* @param allowNoJobs If this is {@code false}, then an error is returned when a wildcard (or {@code _all}) does not match any jobs
93+
* @param allowNoMatch If this is {@code false}, then an error is returned when a wildcard (or {@code _all}) does not match any jobs
9494
*/
95-
public void setAllowNoJobs(boolean allowNoJobs) {
96-
this.allowNoJobs = allowNoJobs;
95+
public void setAllowNoMatch(boolean allowNoMatch) {
96+
this.allowNoMatch = allowNoMatch;
9797
}
9898

99-
public Boolean getAllowNoJobs() {
100-
return allowNoJobs;
99+
public Boolean getAllowNoMatch() {
100+
return allowNoMatch;
101101
}
102102

103103
@Override
104104
public int hashCode() {
105-
return Objects.hash(jobIds, allowNoJobs);
105+
return Objects.hash(jobIds, allowNoMatch);
106106
}
107107

108108
@Override
@@ -117,7 +117,7 @@ public boolean equals(Object other) {
117117

118118
GetJobRequest that = (GetJobRequest) other;
119119
return Objects.equals(jobIds, that.jobIds) &&
120-
Objects.equals(allowNoJobs, that.allowNoJobs);
120+
Objects.equals(allowNoMatch, that.allowNoMatch);
121121
}
122122

123123
@Override
@@ -128,8 +128,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
128128
builder.field(JOB_IDS.getPreferredName(), jobIds);
129129
}
130130

131-
if (allowNoJobs != null) {
132-
builder.field(ALLOW_NO_JOBS.getPreferredName(), allowNoJobs);
131+
if (allowNoMatch != null) {
132+
builder.field(ALLOW_NO_MATCH.getPreferredName(), allowNoMatch);
133133
}
134134

135135
builder.endObject();

0 commit comments

Comments
 (0)