Skip to content

Commit ebb547c

Browse files
committed
[DOCS] Move rollup APIs to docs (#31450)
1 parent 8b93512 commit ebb547c

20 files changed

+301
-10
lines changed

docs/build.gradle

+267
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ buildRestTests.docs = fileTree(projectDir) {
7070
exclude 'build'
7171
// Just syntax examples
7272
exclude 'README.asciidoc'
73+
// Broken code snippet tests
74+
exclude 'reference/rollup/rollup-getting-started.asciidoc'
75+
exclude 'reference/rollup/apis/rollup-job-config.asciidoc'
76+
exclude 'reference/rollup/apis/rollup-index-caps.asciidoc'
77+
exclude 'reference/rollup/apis/put-job.asciidoc'
78+
exclude 'reference/rollup/apis/stop-job.asciidoc'
79+
exclude 'reference/rollup/apis/start-job.asciidoc'
80+
exclude 'reference/rollup/apis/rollup-search.asciidoc'
81+
exclude 'reference/rollup/apis/delete-job.asciidoc'
82+
exclude 'reference/rollup/apis/get-job.asciidoc'
83+
exclude 'reference/rollup/apis/rollup-caps.asciidoc'
7384
}
7485

7586
listSnippets.docs = buildRestTests.docs
@@ -583,3 +594,259 @@ buildRestTests.setups['library'] = '''
583594
{"index":{"_id": "The Moon is a Harsh Mistress"}}
584595
{"name": "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288}
585596
'''
597+
buildRestTests.setups['sensor_rollup_job'] = '''
598+
- do:
599+
indices.create:
600+
index: sensor-1
601+
body:
602+
settings:
603+
number_of_shards: 1
604+
number_of_replicas: 0
605+
mappings:
606+
_doc:
607+
properties:
608+
timestamp:
609+
type: date
610+
temperature:
611+
type: long
612+
voltage:
613+
type: float
614+
node:
615+
type: keyword
616+
- do:
617+
xpack.rollup.put_job:
618+
id: "sensor"
619+
body: >
620+
{
621+
"index_pattern": "sensor-*",
622+
"rollup_index": "sensor_rollup",
623+
"cron": "*/30 * * * * ?",
624+
"page_size" :1000,
625+
"groups" : {
626+
"date_histogram": {
627+
"field": "timestamp",
628+
"interval": "1h",
629+
"delay": "7d"
630+
},
631+
"terms": {
632+
"fields": ["node"]
633+
}
634+
},
635+
"metrics": [
636+
{
637+
"field": "temperature",
638+
"metrics": ["min", "max", "sum"]
639+
},
640+
{
641+
"field": "voltage",
642+
"metrics": ["avg"]
643+
}
644+
]
645+
}
646+
'''
647+
buildRestTests.setups['sensor_started_rollup_job'] = '''
648+
- do:
649+
indices.create:
650+
index: sensor-1
651+
body:
652+
settings:
653+
number_of_shards: 1
654+
number_of_replicas: 0
655+
mappings:
656+
_doc:
657+
properties:
658+
timestamp:
659+
type: date
660+
temperature:
661+
type: long
662+
voltage:
663+
type: float
664+
node:
665+
type: keyword
666+
667+
- do:
668+
bulk:
669+
index: sensor-1
670+
type: _doc
671+
refresh: true
672+
body: |
673+
{"index":{}}
674+
{"timestamp": 1516729294000, "temperature": 200, "voltage": 5.2, "node": "a"}
675+
{"index":{}}
676+
{"timestamp": 1516642894000, "temperature": 201, "voltage": 5.8, "node": "b"}
677+
{"index":{}}
678+
{"timestamp": 1516556494000, "temperature": 202, "voltage": 5.1, "node": "a"}
679+
{"index":{}}
680+
{"timestamp": 1516470094000, "temperature": 198, "voltage": 5.6, "node": "b"}
681+
{"index":{}}
682+
{"timestamp": 1516383694000, "temperature": 200, "voltage": 4.2, "node": "c"}
683+
{"index":{}}
684+
{"timestamp": 1516297294000, "temperature": 202, "voltage": 4.0, "node": "c"}
685+
686+
- do:
687+
xpack.rollup.put_job:
688+
id: "sensor"
689+
body: >
690+
{
691+
"index_pattern": "sensor-*",
692+
"rollup_index": "sensor_rollup",
693+
"cron": "* * * * * ?",
694+
"page_size" :1000,
695+
"groups" : {
696+
"date_histogram": {
697+
"field": "timestamp",
698+
"interval": "1h",
699+
"delay": "7d"
700+
},
701+
"terms": {
702+
"fields": ["node"]
703+
}
704+
},
705+
"metrics": [
706+
{
707+
"field": "temperature",
708+
"metrics": ["min", "max", "sum"]
709+
},
710+
{
711+
"field": "voltage",
712+
"metrics": ["avg"]
713+
}
714+
]
715+
}
716+
- do:
717+
xpack.rollup.start_job:
718+
id: "sensor"
719+
'''
720+
721+
buildRestTests.setups['sensor_index'] = '''
722+
- do:
723+
indices.create:
724+
index: sensor-1
725+
body:
726+
settings:
727+
number_of_shards: 1
728+
number_of_replicas: 0
729+
mappings:
730+
_doc:
731+
properties:
732+
timestamp:
733+
type: date
734+
temperature:
735+
type: long
736+
voltage:
737+
type: float
738+
node:
739+
type: keyword
740+
load:
741+
type: double
742+
net_in:
743+
type: long
744+
net_out:
745+
type: long
746+
hostname:
747+
type: keyword
748+
datacenter:
749+
type: keyword
750+
'''
751+
752+
buildRestTests.setups['sensor_prefab_data'] = '''
753+
- do:
754+
indices.create:
755+
index: sensor-1
756+
body:
757+
settings:
758+
number_of_shards: 1
759+
number_of_replicas: 0
760+
mappings:
761+
_doc:
762+
properties:
763+
timestamp:
764+
type: date
765+
temperature:
766+
type: long
767+
voltage:
768+
type: float
769+
node:
770+
type: keyword
771+
- do:
772+
indices.create:
773+
index: sensor_rollup
774+
body:
775+
settings:
776+
number_of_shards: 1
777+
number_of_replicas: 0
778+
mappings:
779+
_doc:
780+
properties:
781+
node.terms.value:
782+
type: keyword
783+
temperature.sum.value:
784+
type: double
785+
temperature.max.value:
786+
type: double
787+
temperature.min.value:
788+
type: double
789+
timestamp.date_histogram.time_zone:
790+
type: keyword
791+
timestamp.date_histogram.interval:
792+
type: keyword
793+
timestamp.date_histogram.timestamp:
794+
type: date
795+
timestamp.date_histogram._count:
796+
type: long
797+
voltage.avg.value:
798+
type: double
799+
voltage.avg._count:
800+
type: long
801+
_rollup.id:
802+
type: keyword
803+
_rollup.version:
804+
type: long
805+
_meta:
806+
_rollup:
807+
sensor:
808+
cron: "* * * * * ?"
809+
rollup_index: "sensor_rollup"
810+
index_pattern: "sensor-*"
811+
timeout: "20s"
812+
page_size: 1000
813+
groups:
814+
date_histogram:
815+
delay: "7d"
816+
field: "timestamp"
817+
interval: "1h"
818+
time_zone: "UTC"
819+
terms:
820+
fields:
821+
- "node"
822+
id: sensor
823+
metrics:
824+
- field: "temperature"
825+
metrics:
826+
- min
827+
- max
828+
- sum
829+
- field: "voltage"
830+
metrics:
831+
- avg
832+
833+
- do:
834+
bulk:
835+
index: sensor_rollup
836+
type: _doc
837+
refresh: true
838+
body: |
839+
{"index":{}}
840+
{"node.terms.value":"b","temperature.sum.value":201.0,"temperature.max.value":201.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":201.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.800000190734863,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516640400000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
841+
{"index":{}}
842+
{"node.terms.value":"c","temperature.sum.value":200.0,"temperature.max.value":200.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":200.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.199999809265137,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516381200000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
843+
{"index":{}}
844+
{"node.terms.value":"a","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.099999904632568,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516554000000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
845+
{"index":{}}
846+
{"node.terms.value":"a","temperature.sum.value":200.0,"temperature.max.value":200.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":200.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.199999809265137,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516726800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
847+
{"index":{}}
848+
{"node.terms.value":"b","temperature.sum.value":198.0,"temperature.max.value":198.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":198.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":5.599999904632568,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516467600000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
849+
{"index":{}}
850+
{"node.terms.value":"c","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.0,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516294800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
851+
852+
'''

docs/reference/index.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ include::sql/index.asciidoc[]
6363

6464
include::monitoring/index.asciidoc[]
6565

66-
include::{xes-repo-dir}/rollup/index.asciidoc[]
66+
include::rollup/index.asciidoc[]
6767

6868
include::rest-api/index.asciidoc[]
6969

docs/reference/rest-api/index.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include::{xes-repo-dir}/rest-api/graph/explore.asciidoc[]
2323
include::{es-repo-dir}/licensing/index.asciidoc[]
2424
include::{es-repo-dir}/migration/migration.asciidoc[]
2525
include::{xes-repo-dir}/rest-api/ml-api.asciidoc[]
26-
include::{xes-repo-dir}/rest-api/rollup-api.asciidoc[]
26+
include::{es-repo-dir}/rollup/rollup-api.asciidoc[]
2727
include::{xes-repo-dir}/rest-api/security.asciidoc[]
2828
include::{xes-repo-dir}/rest-api/watcher.asciidoc[]
2929
include::{xes-repo-dir}/rest-api/defs.asciidoc[]

x-pack/docs/en/rollup/api-quickref.asciidoc renamed to docs/reference/rollup/api-quickref.asciidoc

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[rollup-api-quickref]]
24
== API Quick Reference
35

x-pack/docs/en/rest-api/rollup/delete-job.asciidoc renamed to docs/reference/rollup/apis/delete-job.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-delete-job]]
34
=== Delete Job API
45
++++

x-pack/docs/en/rest-api/rollup/get-job.asciidoc renamed to docs/reference/rollup/apis/get-job.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-get-job]]
34
=== Get Rollup Jobs API
45
++++

x-pack/docs/en/rest-api/rollup/put-job.asciidoc renamed to docs/reference/rollup/apis/put-job.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-put-job]]
34
=== Create Job API
45
++++

x-pack/docs/en/rest-api/rollup/rollup-caps.asciidoc renamed to docs/reference/rollup/apis/rollup-caps.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-get-rollup-caps]]
34
=== Get Rollup Job Capabilities
45
++++

x-pack/docs/en/rest-api/rollup/rollup-index-caps.asciidoc renamed to docs/reference/rollup/apis/rollup-index-caps.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-get-rollup-index-caps]]
34
=== Get Rollup Index Capabilities
45
++++

x-pack/docs/en/rest-api/rollup/rollup-job-config.asciidoc renamed to docs/reference/rollup/apis/rollup-job-config.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-job-config]]
34
=== Rollup Job Configuration
45

x-pack/docs/en/rest-api/rollup/rollup-search.asciidoc renamed to docs/reference/rollup/apis/rollup-search.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-search]]
34
=== Rollup Search
45
++++

x-pack/docs/en/rest-api/rollup/start-job.asciidoc renamed to docs/reference/rollup/apis/start-job.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-start-job]]
34
=== Start Job API
45
++++

x-pack/docs/en/rest-api/rollup/stop-job.asciidoc renamed to docs/reference/rollup/apis/stop-job.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="basic"]
23
[[rollup-stop-job]]
34
=== Stop Job API
45
++++

x-pack/docs/en/rollup/index.asciidoc renamed to docs/reference/rollup/index.asciidoc

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[xpack-rollup]]
24
= Rolling up historical data
35

x-pack/docs/en/rollup/overview.asciidoc renamed to docs/reference/rollup/overview.asciidoc

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[rollup-overview]]
24
== Overview
35

x-pack/docs/en/rollup/rollup-agg-limitations.asciidoc renamed to docs/reference/rollup/rollup-agg-limitations.asciidoc

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[role="xpack"]
2+
[testenv="basic"]
13
[[rollup-agg-limitations]]
24
== Rollup Aggregation Limitations
35

0 commit comments

Comments
 (0)