Skip to content

Commit

Permalink
Merge branch 'master' into xpack-license
Browse files Browse the repository at this point in the history
* master:
  Deprecate X-Pack centric rollup endpoints (elastic#35962)
  • Loading branch information
jasontedor committed Nov 28, 2018
2 parents 6037c8b + b84f1f6 commit 3107236
Show file tree
Hide file tree
Showing 34 changed files with 200 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private RollupRequestConverters() {

static Request putJob(final PutRollupJobRequest putRollupJobRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "job")
.addPathPartAsIs("_rollup", "job")
.addPathPart(putRollupJobRequest.getConfig().getId())
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
Expand All @@ -52,7 +52,7 @@ static Request putJob(final PutRollupJobRequest putRollupJobRequest) throws IOEx

static Request startJob(final StartRollupJobRequest startRollupJobRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "job")
.addPathPartAsIs("_rollup", "job")
.addPathPart(startRollupJobRequest.getJobId())
.addPathPartAsIs("_start")
.build();
Expand All @@ -61,7 +61,7 @@ static Request startJob(final StartRollupJobRequest startRollupJobRequest) throw

static Request stopJob(final StopRollupJobRequest stopRollupJobRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "job")
.addPathPartAsIs("_rollup", "job")
.addPathPart(stopRollupJobRequest.getJobId())
.addPathPartAsIs("_stop")
.build();
Expand All @@ -77,15 +77,15 @@ static Request stopJob(final StopRollupJobRequest stopRollupJobRequest) throws I

static Request getJob(final GetRollupJobRequest getRollupJobRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "job")
.addPathPartAsIs("_rollup", "job")
.addPathPart(getRollupJobRequest.getJobId())
.build();
return new Request(HttpGet.METHOD_NAME, endpoint);
}

static Request deleteJob(final DeleteRollupJobRequest deleteRollupJobRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "job")
.addPathPartAsIs("_rollup", "job")
.addPathPart(deleteRollupJobRequest.getId())
.build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand All @@ -95,7 +95,7 @@ static Request deleteJob(final DeleteRollupJobRequest deleteRollupJobRequest) th

static Request getRollupCaps(final GetRollupCapsRequest getRollupCapsRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "rollup", "data")
.addPathPartAsIs("_rollup", "data")
.addPathPart(getRollupCapsRequest.getIndexPattern())
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
Expand All @@ -106,7 +106,7 @@ static Request getRollupCaps(final GetRollupCapsRequest getRollupCapsRequest) th
static Request getRollupIndexCaps(final GetRollupIndexCapsRequest getRollupIndexCapsRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addCommaSeparatedPathParts(getRollupIndexCapsRequest.indices())
.addPathPartAsIs("_xpack", "rollup", "data")
.addPathPartAsIs("_rollup", "data")
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
request.setEntity(createEntity(getRollupIndexCapsRequest, REQUEST_BODY_CONTENT_TYPE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testPutJob() throws IOException {
PutRollupJobRequest put = new PutRollupJobRequest(config);

Request request = RollupRequestConverters.putJob(put);
assertThat(request.getEndpoint(), equalTo("/_xpack/rollup/job/" + job));
assertThat(request.getEndpoint(), equalTo("/_rollup/job/" + job));
assertThat(HttpPut.METHOD_NAME, equalTo(request.getMethod()));
assertThat(request.getParameters().keySet(), empty());
RequestConvertersTests.assertToXContentBody(put, request.getEntity());
Expand All @@ -57,7 +57,7 @@ public void testStartJob() throws IOException {
StartRollupJobRequest startJob = new StartRollupJobRequest(jobId);

Request request = RollupRequestConverters.startJob(startJob);
assertThat(request.getEndpoint(), equalTo("/_xpack/rollup/job/" + jobId + "/_start"));
assertThat(request.getEndpoint(), equalTo("/_rollup/job/" + jobId + "/_start"));
assertThat(HttpPost.METHOD_NAME, equalTo(request.getMethod()));
assertThat(request.getParameters().keySet(), empty());
assertThat(request.getEntity(), nullValue());
Expand All @@ -81,7 +81,7 @@ public void testStopJob() throws IOException {
}

Request request = RollupRequestConverters.stopJob(stopJob);
assertThat(request.getEndpoint(), equalTo("/_xpack/rollup/job/" + jobId + "/_stop"));
assertThat(request.getEndpoint(), equalTo("/_rollup/job/" + jobId + "/_stop"));
assertThat(HttpPost.METHOD_NAME, equalTo(request.getMethod()));
assertThat(request.getParameters().keySet().size(), equalTo(expectedParameters));
assertThat(request.getParameters().get("timeout"), equalTo(expectedTimeOutString));
Expand All @@ -95,7 +95,7 @@ public void testGetJob() {
GetRollupJobRequest get = getAll ? new GetRollupJobRequest() : new GetRollupJobRequest(job);

Request request = RollupRequestConverters.getJob(get);
assertThat(request.getEndpoint(), equalTo("/_xpack/rollup/job/" + job));
assertThat(request.getEndpoint(), equalTo("/_rollup/job/" + job));
assertThat(HttpGet.METHOD_NAME, equalTo(request.getMethod()));
assertThat(request.getParameters().keySet(), empty());
assertThat(request.getEntity(), nullValue());
Expand Down
6 changes: 3 additions & 3 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ buildRestTests.setups['sensor_rollup_job'] = '''
- do:
raw:
method: PUT
path: _xpack/rollup/job/sensor
path: _rollup/job/sensor
body: >
{
"index_pattern": "sensor-*",
Expand Down Expand Up @@ -696,7 +696,7 @@ buildRestTests.setups['sensor_started_rollup_job'] = '''
- do:
raw:
method: PUT
path: _xpack/rollup/job/sensor
path: _rollup/job/sensor
body: >
{
"index_pattern": "sensor-*",
Expand Down Expand Up @@ -727,7 +727,7 @@ buildRestTests.setups['sensor_started_rollup_job'] = '''
- do:
raw:
method: POST
path: _xpack/rollup/job/sensor/_start
path: _rollup/job/sensor/_start
'''

buildRestTests.setups['sensor_index'] = '''
Expand Down
16 changes: 8 additions & 8 deletions docs/reference/rollup/api-quickref.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ Most {rollup} endpoints have the following base:

[source,js]
----
/_xpack/rollup/
/_rollup/
----
// NOTCONSOLE

[float]
[[rollup-api-jobs]]
=== /job/

* {ref}/rollup-put-job.html[PUT /_xpack/rollup/job/<job_id+++>+++]: Create a job
* {ref}/rollup-get-job.html[GET /_xpack/rollup/job]: List jobs
* {ref}/rollup-get-job.html[GET /_xpack/rollup/job/<job_id+++>+++]: Get job details
* {ref}/rollup-start-job.html[POST /_xpack/rollup/job/<job_id>/_start]: Start a job
* {ref}/rollup-stop-job.html[POST /_xpack/rollup/job/<job_id>/_stop]: Stop a job
* {ref}/rollup-delete-job.html[DELETE /_xpack/rollup/job/<job_id+++>+++]: Delete a job
* {ref}/rollup-put-job.html[PUT /_rollup/job/<job_id+++>+++]: Create a job
* {ref}/rollup-get-job.html[GET /_rollup/job]: List jobs
* {ref}/rollup-get-job.html[GET /_rollup/job/<job_id+++>+++]: Get job details
* {ref}/rollup-start-job.html[POST /_rollup/job/<job_id>/_start]: Start a job
* {ref}/rollup-stop-job.html[POST /_rollup/job/<job_id>/_stop]: Stop a job
* {ref}/rollup-delete-job.html[DELETE /_rollup/job/<job_id+++>+++]: Delete a job

[float]
[[rollup-api-data]]
=== /data/

* {ref}/rollup-get-rollup-caps.html[GET /_xpack/rollup/data/<index_pattern+++>/_rollup_caps+++]: Get Rollup Capabilities
* {ref}/rollup-get-rollup-caps.html[GET /_rollup/data/<index_pattern+++>/_rollup_caps+++]: Get Rollup Capabilities
* {ref}/rollup-get-rollup-index-caps.html[GET /<index_name+++>/_rollup/data/+++]: Get Rollup Index Capabilities

[float]
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/rollup/apis/delete-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ POST my_rollup_index/_delete_by_query
**********************************
==== Request

`DELETE _xpack/rollup/job/<job_id>`
`DELETE _rollup/job/<job_id>`

//===== Description

Expand All @@ -66,7 +66,7 @@ If we have a rollup job named `sensor`, it can be deleted with:

[source,js]
--------------------------------------------------
DELETE _xpack/rollup/job/sensor
DELETE _rollup/job/sensor
--------------------------------------------------
// CONSOLE
// TEST[setup:sensor_rollup_job]
Expand All @@ -85,7 +85,7 @@ If however we try to delete a job which doesn't exist:

[source,js]
--------------------------------------------------
DELETE _xpack/rollup/job/does_not_exist
DELETE _rollup/job/does_not_exist
--------------------------------------------------
// CONSOLE
// TEST[catch:missing]
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/rollup/apis/get-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For details about a historical job, the <<rollup-get-rollup-caps,Rollup Capabili

==== Request

`GET _xpack/rollup/job/<job_id>`
`GET _rollup/job/<job_id>`

//===== Description

Expand All @@ -44,7 +44,7 @@ If we have already created a rollup job named `sensor`, the details about the jo

[source,js]
--------------------------------------------------
GET _xpack/rollup/job/sensor
GET _rollup/job/sensor
--------------------------------------------------
// CONSOLE
// TEST[setup:sensor_rollup_job]
Expand Down Expand Up @@ -140,7 +140,7 @@ If we add another job, we can see how multi-job responses are handled:

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor2 <1>
PUT _rollup/job/sensor2 <1>
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down Expand Up @@ -168,7 +168,7 @@ PUT _xpack/rollup/job/sensor2 <1>
]
}
GET _xpack/rollup/job/_all <2>
GET _rollup/job/_all <2>
--------------------------------------------------
// CONSOLE
// TEST[setup:sensor_rollup_job]
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/rollup/apis/put-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ started with the <<rollup-start-job,Start Job API>>.

==== Request

`PUT _xpack/rollup/job/<job_id>`
`PUT _rollup/job/<job_id>`

//===== Description

Expand Down Expand Up @@ -59,7 +59,7 @@ The following example creates a rollup job named "sensor", targeting the "sensor

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
PUT _rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/rollup/apis/rollup-caps.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ live?

==== Request

`GET _xpack/rollup/data/{index}`
`GET _rollup/data/{index}`

//===== Description

Expand Down Expand Up @@ -50,7 +50,7 @@ this future scaling:

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
PUT _rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down Expand Up @@ -85,7 +85,7 @@ We can then retrieve the rollup capabilities of that index pattern (`sensor-*`)

[source,js]
--------------------------------------------------
GET _xpack/rollup/data/sensor-*
GET _rollup/data/sensor-*
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down Expand Up @@ -155,7 +155,7 @@ We could also retrieve the same information with a request to `_all`:

[source,js]
--------------------------------------------------
GET _xpack/rollup/data/_all
GET _rollup/data/_all
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand All @@ -164,7 +164,7 @@ But note that if we use the concrete index name (`sensor-1`), we'll retrieve no

[source,js]
--------------------------------------------------
GET _xpack/rollup/data/sensor-1
GET _rollup/data/sensor-1
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/rollup/apis/rollup-index-caps.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This API will allow you to determine:

==== Request

`GET {index}/_xpack/rollup/data`
`GET {index}/_rollup/data`

//===== Description

Expand All @@ -44,7 +44,7 @@ will be a `sensor-2`, `sensor-3`, etc. Let's create a Rollup job, which stores

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
PUT _rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down Expand Up @@ -80,7 +80,7 @@ Index API:

[source,js]
--------------------------------------------------
GET /sensor_rollup/_xpack/rollup/data
GET /sensor_rollup/_rollup/data
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down Expand Up @@ -153,7 +153,7 @@ Like other APIs that interact with indices, you can specify index patterns inste

[source,js]
--------------------------------------------------
GET /*_rollup/_xpack/rollup/data
GET /*_rollup/_rollup/data
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/rollup/apis/rollup-job-config.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A full job configuration might look like this:

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
PUT _rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/rollup/apis/rollup-search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Imagine we have an index named `sensor-1` full of raw data, and we have created

[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
PUT _rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/rollup/apis/start-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Starting an already started job has no action.

==== Request

`POST _xpack/rollup/job/<job_id>/_start`
`POST _rollup/job/<job_id>/_start`

//===== Description

Expand All @@ -39,7 +39,7 @@ If we have already created a rollup job named `sensor`, it can be started with:

[source,js]
--------------------------------------------------
POST _xpack/rollup/job/sensor/_start
POST _rollup/job/sensor/_start
--------------------------------------------------
// CONSOLE
// TEST[setup:sensor_rollup_job]
Expand All @@ -58,7 +58,7 @@ If however we try to start a job which doesn't exist:

[source,js]
--------------------------------------------------
POST _xpack/rollup/job/does_not_exist/_start
POST _rollup/job/does_not_exist/_start
--------------------------------------------------
// CONSOLE
// TEST[catch:missing]
Expand Down
Loading

0 comments on commit 3107236

Please sign in to comment.