19
19
package org .elasticsearch .client ;
20
20
21
21
import org .elasticsearch .action .ActionListener ;
22
- import org .elasticsearch .protocol .xpack .ml .CloseJobRequest ;
23
- import org .elasticsearch .protocol .xpack .ml .CloseJobResponse ;
24
- import org .elasticsearch .protocol .xpack .ml .DeleteJobRequest ;
25
- import org .elasticsearch .protocol .xpack .ml .DeleteJobResponse ;
26
- import org .elasticsearch .protocol .xpack .ml .GetBucketsRequest ;
27
- import org .elasticsearch .protocol .xpack .ml .GetBucketsResponse ;
28
- import org .elasticsearch .protocol .xpack .ml .GetJobRequest ;
29
- import org .elasticsearch .protocol .xpack .ml .GetJobResponse ;
30
- import org .elasticsearch .protocol .xpack .ml .OpenJobRequest ;
31
- import org .elasticsearch .protocol .xpack .ml .OpenJobResponse ;
32
- import org .elasticsearch .protocol .xpack .ml .PutJobRequest ;
33
- import org .elasticsearch .protocol .xpack .ml .PutJobResponse ;
22
+ import org .elasticsearch .client .ml .CloseJobRequest ;
23
+ import org .elasticsearch .client .ml .CloseJobResponse ;
24
+ import org .elasticsearch .client .ml .DeleteJobRequest ;
25
+ import org .elasticsearch .client .ml .DeleteJobResponse ;
26
+ import org .elasticsearch .client .ml .GetBucketsRequest ;
27
+ import org .elasticsearch .client .ml .GetBucketsResponse ;
28
+ import org .elasticsearch .client .ml .GetJobRequest ;
29
+ import org .elasticsearch .client .ml .GetJobResponse ;
30
+ import org .elasticsearch .client .ml .GetRecordsRequest ;
31
+ import org .elasticsearch .client .ml .GetRecordsResponse ;
32
+ import org .elasticsearch .client .ml .OpenJobRequest ;
33
+ import org .elasticsearch .client .ml .OpenJobResponse ;
34
+ import org .elasticsearch .client .ml .PutJobRequest ;
35
+ import org .elasticsearch .client .ml .PutJobResponse ;
34
36
35
37
import java .io .IOException ;
36
38
import java .util .Collections ;
@@ -56,9 +58,9 @@ public final class MachineLearningClient {
56
58
* For additional info
57
59
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html">ML PUT job documentation</a>
58
60
*
59
- * @param request The PutJobRequest containing the {@link org.elasticsearch.protocol.xpack .ml.job.config.Job} settings
61
+ * @param request The PutJobRequest containing the {@link org.elasticsearch.client .ml.job.config.Job} settings
60
62
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
61
- * @return PutJobResponse with enclosed {@link org.elasticsearch.protocol.xpack .ml.job.config.Job} object
63
+ * @return PutJobResponse with enclosed {@link org.elasticsearch.client .ml.job.config.Job} object
62
64
* @throws IOException when there is a serialization issue sending the request or receiving the response
63
65
*/
64
66
public PutJobResponse putJob (PutJobRequest request , RequestOptions options ) throws IOException {
@@ -75,7 +77,7 @@ public PutJobResponse putJob(PutJobRequest request, RequestOptions options) thro
75
77
* For additional info
76
78
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html">ML PUT job documentation</a>
77
79
*
78
- * @param request The request containing the {@link org.elasticsearch.protocol.xpack .ml.job.config.Job} settings
80
+ * @param request The request containing the {@link org.elasticsearch.client .ml.job.config.Job} settings
79
81
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
80
82
* @param listener Listener to be notified upon request completion
81
83
*/
@@ -98,7 +100,7 @@ public void putJobAsync(PutJobRequest request, RequestOptions options, ActionLis
98
100
* @param request {@link GetJobRequest} Request containing a list of jobId(s) and additional options
99
101
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
100
102
* @return {@link GetJobResponse} response object containing
101
- * the {@link org.elasticsearch.protocol.xpack .ml.job.config.Job} objects and the number of jobs found
103
+ * the {@link org.elasticsearch.client .ml.job.config.Job} objects and the number of jobs found
102
104
* @throws IOException when there is a serialization issue sending the request or receiving the response
103
105
*/
104
106
public GetJobResponse getJob (GetJobRequest request , RequestOptions options ) throws IOException {
@@ -285,4 +287,40 @@ public void getBucketsAsync(GetBucketsRequest request, RequestOptions options, A
285
287
listener ,
286
288
Collections .emptySet ());
287
289
}
290
+
291
+ /**
292
+ * Gets the records for a Machine Learning Job.
293
+ * <p>
294
+ * For additional info
295
+ * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html">ML GET records documentation</a>
296
+ *
297
+ * @param request the request
298
+ * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
299
+ */
300
+ public GetRecordsResponse getRecords (GetRecordsRequest request , RequestOptions options ) throws IOException {
301
+ return restHighLevelClient .performRequestAndParseEntity (request ,
302
+ MLRequestConverters ::getRecords ,
303
+ options ,
304
+ GetRecordsResponse ::fromXContent ,
305
+ Collections .emptySet ());
306
+ }
307
+
308
+ /**
309
+ * Gets the records for a Machine Learning Job, notifies listener once the requested records are retrieved.
310
+ * <p>
311
+ * For additional info
312
+ * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html">ML GET records documentation</a>
313
+ *
314
+ * @param request the request
315
+ * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
316
+ * @param listener Listener to be notified upon request completion
317
+ */
318
+ public void getRecordsAsync (GetRecordsRequest request , RequestOptions options , ActionListener <GetRecordsResponse > listener ) {
319
+ restHighLevelClient .performRequestAsyncAndParseEntity (request ,
320
+ MLRequestConverters ::getRecords ,
321
+ options ,
322
+ GetRecordsResponse ::fromXContent ,
323
+ listener ,
324
+ Collections .emptySet ());
325
+ }
288
326
}
0 commit comments