You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 16, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: docs/im/index-rollups/index.md
+368Lines changed: 368 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,3 +87,371 @@ GET target_index/_search
87
87
```
88
88
89
89
Consider a scenario where you collect rolled up data from 1 PM to 9 PM in hourly intervals and live data from 7 PM to 11 PM in minutely intervals. If you execute an aggregation over these in the same query, for 7 PM to 9 PM, you see an overlap of both rolled up data and live data because they get counted twice in the aggregations.
90
+
91
+
## Sample Walkthrough
92
+
93
+
This walkthrough uses the Kibana sample e-commerce data. To add that sample data, log in to Kibana, choose **Home** and **Try our sample data**. For **Sample eCommerce orders**, choose **Add data**.
This example picks the `order_date`, `customer_gender`, `geoip.city_name`, `geoip.region_name`, and `day_of_week` fields and rolls them into an `example_rollup` target index:
220
+
221
+
```json
222
+
PUT _opendistro/_rollup/jobs/example
223
+
{
224
+
"rollup": {
225
+
"enabled": true,
226
+
"schedule": {
227
+
"interval": {
228
+
"period": 1,
229
+
"unit": "Minutes",
230
+
"start_time": 1602100553
231
+
}
232
+
},
233
+
"last_updated_time": 1602100553,
234
+
"description": "An example policy that rolls up the sample ecommerce data",
235
+
"source_index": "kibana_sample_data_ecommerce",
236
+
"target_index": "example_rollup",
237
+
"page_size": 1000,
238
+
"delay": 0,
239
+
"continuous": false,
240
+
"dimensions": [
241
+
{
242
+
"date_histogram": {
243
+
"source_field": "order_date",
244
+
"fixed_interval": "60m",
245
+
"timezone": "America/Los_Angeles"
246
+
}
247
+
},
248
+
{
249
+
"terms": {
250
+
"source_field": "customer_gender"
251
+
}
252
+
},
253
+
{
254
+
"terms": {
255
+
"source_field": "geoip.city_name"
256
+
}
257
+
},
258
+
{
259
+
"terms": {
260
+
"source_field": "geoip.region_name"
261
+
}
262
+
},
263
+
{
264
+
"terms": {
265
+
"source_field": "day_of_week"
266
+
}
267
+
}
268
+
],
269
+
"metrics": [
270
+
{
271
+
"source_field": "taxless_total_price",
272
+
"metrics": [
273
+
{
274
+
"avg": {}
275
+
},
276
+
{
277
+
"sum": {}
278
+
},
279
+
{
280
+
"max": {}
281
+
},
282
+
{
283
+
"min": {}
284
+
},
285
+
{
286
+
"value_count": {}
287
+
}
288
+
]
289
+
},
290
+
{
291
+
"source_field": "total_quantity",
292
+
"metrics": [
293
+
{
294
+
"avg": {}
295
+
},
296
+
{
297
+
"max": {}
298
+
}
299
+
]
300
+
}
301
+
]
302
+
}
303
+
}
304
+
```
305
+
306
+
You can query the `example_rollup` index for the terms aggregations on the fields set up in the rollup job.
307
+
You get back the same response that you would on the original `kibana_sample_data_ecommerce` source index.
0 commit comments