Skip to content

Commit e771da4

Browse files
committed
[DOCS] Move rollup APIs to docs (#31450)
1 parent e8bbc35 commit e771da4

19 files changed

+304
-11
lines changed

docs/build.gradle

Lines changed: 271 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ buildRestTests.docs = fileTree(projectDir) {
5858
exclude 'build.gradle'
5959
// That is where the snippets go, not where they come from!
6060
exclude 'build'
61+
// Just syntax examples
62+
exclude 'README.asciidoc'
63+
// Broken code snippet tests
64+
exclude 'reference/rollup/rollup-getting-started.asciidoc'
65+
exclude 'reference/rollup/apis/rollup-job-config.asciidoc'
66+
exclude 'reference/rollup/apis/rollup-index-caps.asciidoc'
67+
exclude 'reference/rollup/apis/put-job.asciidoc'
68+
exclude 'reference/rollup/apis/stop-job.asciidoc'
69+
exclude 'reference/rollup/apis/start-job.asciidoc'
70+
exclude 'reference/rollup/apis/rollup-search.asciidoc'
71+
exclude 'reference/rollup/apis/delete-job.asciidoc'
72+
exclude 'reference/rollup/apis/get-job.asciidoc'
73+
exclude 'reference/rollup/apis/rollup-caps.asciidoc'
6174
}
6275

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

docs/reference/index.asciidoc

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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-job-config.asciidoc renamed to docs/reference/rollup/apis/rollup-job-config.asciidoc

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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)