23
23
import org .elasticsearch .protocol .xpack .ml .CloseJobResponse ;
24
24
import org .elasticsearch .protocol .xpack .ml .DeleteJobRequest ;
25
25
import org .elasticsearch .protocol .xpack .ml .DeleteJobResponse ;
26
+ import org .elasticsearch .protocol .xpack .ml .GetBucketsRequest ;
27
+ import org .elasticsearch .protocol .xpack .ml .GetBucketsResponse ;
26
28
import org .elasticsearch .protocol .xpack .ml .GetJobRequest ;
27
29
import org .elasticsearch .protocol .xpack .ml .GetJobResponse ;
28
30
import org .elasticsearch .protocol .xpack .ml .OpenJobRequest ;
@@ -54,7 +56,7 @@ public final class MachineLearningClient {
54
56
* For additional info
55
57
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html">ML PUT job documentation</a>
56
58
*
57
- * @param request the PutJobRequest containing the {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} settings
59
+ * @param request The PutJobRequest containing the {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} settings
58
60
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
59
61
* @return PutJobResponse with enclosed {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} object
60
62
* @throws IOException when there is a serialization issue sending the request or receiving the response
@@ -73,7 +75,7 @@ public PutJobResponse putJob(PutJobRequest request, RequestOptions options) thro
73
75
* For additional info
74
76
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html">ML PUT job documentation</a>
75
77
*
76
- * @param request the request containing the {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} settings
78
+ * @param request The request containing the {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} settings
77
79
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
78
80
* @param listener Listener to be notified upon request completion
79
81
*/
@@ -93,7 +95,7 @@ public void putJobAsync(PutJobRequest request, RequestOptions options, ActionLis
93
95
* For additional info
94
96
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html"></a>
95
97
* </p>
96
- * @param request {@link GetJobRequest} request containing a list of jobId(s) and additional options
98
+ * @param request {@link GetJobRequest} Request containing a list of jobId(s) and additional options
97
99
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
98
100
* @return {@link GetJobResponse} response object containing
99
101
* the {@link org.elasticsearch.protocol.xpack.ml.job.config.Job} objects and the number of jobs found
@@ -114,7 +116,7 @@ public GetJobResponse getJob(GetJobRequest request, RequestOptions options) thro
114
116
* For additional info
115
117
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html"></a>
116
118
* </p>
117
- * @param request {@link GetJobRequest} request containing a list of jobId(s) and additional options
119
+ * @param request {@link GetJobRequest} Request containing a list of jobId(s) and additional options
118
120
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
119
121
* @param listener Listener to be notified with {@link GetJobResponse} upon request completion
120
122
*/
@@ -133,7 +135,7 @@ public void getJobAsync(GetJobRequest request, RequestOptions options, ActionLis
133
135
* For additional info
134
136
* see <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html">ML Delete Job documentation</a>
135
137
* </p>
136
- * @param request the request to delete the job
138
+ * @param request The request to delete the job
137
139
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
138
140
* @return action acknowledgement
139
141
* @throws IOException when there is a serialization issue sending the request or receiving the response
@@ -152,7 +154,7 @@ public DeleteJobResponse deleteJob(DeleteJobRequest request, RequestOptions opti
152
154
* For additional info
153
155
* see <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html">ML Delete Job documentation</a>
154
156
* </p>
155
- * @param request the request to delete the job
157
+ * @param request The request to delete the job
156
158
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
157
159
* @param listener Listener to be notified upon request completion
158
160
*/
@@ -176,7 +178,7 @@ public void deleteJobAsync(DeleteJobRequest request, RequestOptions options, Act
176
178
* For additional info
177
179
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html"></a>
178
180
* </p>
179
- * @param request request containing job_id and additional optional options
181
+ * @param request Request containing job_id and additional optional options
180
182
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
181
183
* @return response containing if the job was successfully opened or not.
182
184
* @throws IOException when there is a serialization issue sending the request or receiving the response
@@ -199,7 +201,7 @@ public OpenJobResponse openJob(OpenJobRequest request, RequestOptions options) t
199
201
* For additional info
200
202
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html"></a>
201
203
* </p>
202
- * @param request request containing job_id and additional optional options
204
+ * @param request Request containing job_id and additional optional options
203
205
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
204
206
* @param listener Listener to be notified upon request completion
205
207
*/
@@ -217,7 +219,7 @@ public void openJobAsync(OpenJobRequest request, RequestOptions options, ActionL
217
219
*
218
220
* A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results.
219
221
*
220
- * @param request request containing job_ids and additional options. See {@link CloseJobRequest}
222
+ * @param request Request containing job_ids and additional options. See {@link CloseJobRequest}
221
223
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
222
224
* @return response containing if the job was successfully closed or not.
223
225
* @throws IOException when there is a serialization issue sending the request or receiving the response
@@ -235,7 +237,7 @@ public CloseJobResponse closeJob(CloseJobRequest request, RequestOptions options
235
237
*
236
238
* A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results.
237
239
*
238
- * @param request request containing job_ids and additional options. See {@link CloseJobRequest}
240
+ * @param request Request containing job_ids and additional options. See {@link CloseJobRequest}
239
241
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
240
242
* @param listener Listener to be notified upon request completion
241
243
*/
@@ -247,4 +249,40 @@ public void closeJobAsync(CloseJobRequest request, RequestOptions options, Actio
247
249
listener ,
248
250
Collections .emptySet ());
249
251
}
252
+
253
+ /**
254
+ * Gets the buckets for a Machine Learning Job.
255
+ * <p>
256
+ * For additional info
257
+ * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html">ML GET buckets documentation</a>
258
+ *
259
+ * @param request The request
260
+ * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
261
+ */
262
+ public GetBucketsResponse getBuckets (GetBucketsRequest request , RequestOptions options ) throws IOException {
263
+ return restHighLevelClient .performRequestAndParseEntity (request ,
264
+ MLRequestConverters ::getBuckets ,
265
+ options ,
266
+ GetBucketsResponse ::fromXContent ,
267
+ Collections .emptySet ());
268
+ }
269
+
270
+ /**
271
+ * Gets the buckets for a Machine Learning Job, notifies listener once the requested buckets are retrieved.
272
+ * <p>
273
+ * For additional info
274
+ * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html">ML GET buckets documentation</a>
275
+ *
276
+ * @param request The request
277
+ * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
278
+ * @param listener Listener to be notified upon request completion
279
+ */
280
+ public void getBucketsAsync (GetBucketsRequest request , RequestOptions options , ActionListener <GetBucketsResponse > listener ) {
281
+ restHighLevelClient .performRequestAsyncAndParseEntity (request ,
282
+ MLRequestConverters ::getBuckets ,
283
+ options ,
284
+ GetBucketsResponse ::fromXContent ,
285
+ listener ,
286
+ Collections .emptySet ());
287
+ }
250
288
}
0 commit comments