- Java REST Client (deprecated): other versions:
- Overview
- Java Low Level REST Client
- Java High Level REST Client
- Getting started
- Document APIs
- Search APIs
- Miscellaneous APIs
- Index APIs
- Analyze API
- Create Index API
- Delete Index API
- Index Exists API
- Open Index API
- Close Index API
- Shrink Index API
- Split Index API
- Clone Index API
- Refresh API
- Flush API
- Flush Synced API
- Clear Cache API
- Force Merge API
- Rollover Index API
- Put Mapping API
- Get Mappings API
- Get Field Mappings API
- Index Aliases API
- Exists Alias API
- Get Alias API
- Update Indices Settings API
- Get Settings API
- Put Template API
- Validate Query API
- Get Templates API
- Templates Exist API
- Get Index API
- Freeze Index API
- Unfreeze Index API
- Delete Template API
- Reload Search Analyzers API
- Cluster APIs
- Ingest APIs
- Snapshot APIs
- Tasks APIs
- Script APIs
- Licensing APIs
- Machine Learning APIs
- Put anomaly detection job API
- Get anomaly detection jobs API
- Delete anomaly detection job API
- Open anomaly detection job API
- Close anomaly detection job API
- Update anomaly detection job API
- Flush Job API
- Put datafeed API
- Update datafeed API
- Get datafeed API
- Delete datafeed API
- Preview Datafeed API
- Start datafeed API
- Stop Datafeed API
- Get datafeed stats API
- Get anomaly detection job stats API
- Forecast Job API
- Delete Forecast API
- Get buckets API
- Get overall buckets API
- Get records API
- Post Data API
- Get influencers API
- Get categories API
- Get calendars API
- Put calendar API
- Get calendar events API
- Post Calendar Event API
- Delete calendar event API
- Put anomaly detection jobs in calendar API
- Delete anomaly detection jobs from calendar API
- Delete calendar API
- Get data frame analytics jobs API
- Get data frame analytics jobs stats API
- Put data frame analytics jobs API
- Delete data frame analytics jobs API
- Start data frame analytics jobs API
- Stop data frame analytics jobs API
- Evaluate data frame analytics API
- Estimate memory usage API
- Put Filter API
- Get filters API
- Update filter API
- Delete Filter API
- Get model snapshots API
- Delete Model Snapshot API
- Revert Model Snapshot API
- Update model snapshot API
- ML get info API
- Delete Expired Data API
- Set Upgrade Mode API
- Migration APIs
- Rollup APIs
- Security APIs
- Put User API
- Get Users API
- Delete User API
- Enable User API
- Disable User API
- Change Password API
- Put Role API
- Get Roles API
- Delete Role API
- Delete Privileges API
- Get Builtin Privileges API
- Get Privileges API
- Clear Roles Cache API
- Clear Realm Cache API
- Authenticate API
- Has Privileges API
- Get User Privileges API
- SSL Certificate API
- Put Role Mapping API
- Get Role Mappings API
- Delete Role Mapping API
- Create Token API
- Invalidate Token API
- Put Privileges API
- Create API Key API
- Get API Key information API
- Invalidate API Key API
- Watcher APIs
- Graph APIs
- CCR APIs
- Index Lifecycle Management APIs
- Snapshot Lifecycle Management APIs
- Transform APIs
- Using Java Builders
- Migration Guide
- License
Put Rollup Job API
editPut Rollup Job API
editThis functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
The Put Rollup Job API can be used to create a new Rollup job
in the cluster. The API accepts a PutRollupJobRequest
object
as a request and returns a PutRollupJobResponse
.
Put Rollup Job Request
editA PutRollupJobRequest
requires the following argument:
Rollup Job Configuration
editThe RollupJobConfig
object contains all the details about the rollup job
configuration. See create rollup job API to learn more
about the various configuration settings.
A RollupJobConfig
requires the following arguments:
RollupJobConfig config = new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groups, metrics, timeout);
The name of the Rollup job |
|
The index (or index pattern) to rollup |
|
The index to store rollup results into |
|
A cron expression which defines when the Rollup job should be executed |
|
The page size to use for the Rollup job |
|
The grouping configuration of the Rollup job as a |
|
The metrics configuration of the Rollup job as a list of |
|
The timeout value to use for the Rollup job as a |
Grouping Configuration
editThe grouping configuration of the Rollup job is defined in the RollupJobConfig
using a GroupConfig
instance. GroupConfig
reflects all the configuration
settings that can be defined using the REST API. See Grouping config
to learn more about these settings.
Using the REST API, we could define this grouping configuration:
"groups" : { "date_histogram": { "field": "timestamp", "calendar_interval": "1h", "delay": "7d", "time_zone": "UTC" }, "terms": { "fields": ["hostname", "datacenter"] }, "histogram": { "fields": ["load", "net_in", "net_out"], "interval": 5 } }
Using the GroupConfig
object and the high level REST client, the same
configuration would be:
DateHistogramGroupConfig dateHistogram = new DateHistogramGroupConfig("timestamp", DateHistogramInterval.HOUR, new DateHistogramInterval("7d"), "UTC"); TermsGroupConfig terms = new TermsGroupConfig("hostname", "datacenter"); HistogramGroupConfig histogram = new HistogramGroupConfig(5L, "load", "net_in", "net_out"); GroupConfig groups = new GroupConfig(dateHistogram, histogram, terms);
Metrics Configuration
editAfter defining which groups should be generated for the data, you next configure
which metrics should be collected. The list of metrics is defined in the RollupJobConfig
using a List<MetricConfig>
instance. MetricConfig
reflects all the configuration
settings that can be defined using the REST API. See Metrics config
to learn more about these settings.
Using the REST API, we could define this metrics configuration:
"metrics": [ { "field": "temperature", "metrics": ["min", "max", "sum"] }, { "field": "voltage", "metrics": ["avg", "value_count"] } ]
Using the MetricConfig
object and the high level REST client, the same
configuration would be:
Execution
editThe Put Rollup Job API can be executed through a RollupClient
instance. Such instance can be retrieved from a RestHighLevelClient
using the rollup()
method:
AcknowledgedResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
Response
editThe returned PutRollupJobResponse
indicates if the new Rollup job
has been successfully created:
Asynchronous Execution
editThis request can be executed asynchronously:
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for PutRollupJobResponse
looks like:
On this page