Skip to content

Commit

Permalink
[Transform] move root endpoint to _transform with BWC layer (#47127) (#…
Browse files Browse the repository at this point in the history
…47682)

move the main endpoint to /_transform/ from /_data_frame/transforms/ with providing backwards compatibility and deprecation warnings
  • Loading branch information
Hendrik Muhs authored Oct 8, 2019
1 parent 91988c7 commit 5e0e54f
Show file tree
Hide file tree
Showing 94 changed files with 1,580 additions and 276 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private TransformRequestConverters() {}

static Request putTransform(PutTransformRequest putRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(putRequest.getConfig().getId())
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
Expand All @@ -61,7 +61,7 @@ static Request putTransform(PutTransformRequest putRequest) throws IOException {

static Request updateTransform(UpdateTransformRequest updateDataFrameTransformRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(updateDataFrameTransformRequest.getId())
.addPathPart("_update")
.build();
Expand All @@ -75,7 +75,7 @@ static Request updateTransform(UpdateTransformRequest updateDataFrameTransformRe

static Request getTransform(GetTransformRequest getRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(Strings.collectionToCommaDelimitedString(getRequest.getId()))
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
Expand All @@ -93,7 +93,7 @@ static Request getTransform(GetTransformRequest getRequest) {

static Request deleteTransform(DeleteTransformRequest deleteRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(deleteRequest.getId())
.build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand All @@ -105,7 +105,7 @@ static Request deleteTransform(DeleteTransformRequest deleteRequest) {

static Request startTransform(StartTransformRequest startRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(startRequest.getId())
.addPathPartAsIs("_start")
.build();
Expand All @@ -120,7 +120,7 @@ static Request startTransform(StartTransformRequest startRequest) {

static Request stopTransform(StopTransformRequest stopRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(stopRequest.getId())
.addPathPartAsIs("_stop")
.build();
Expand All @@ -141,7 +141,7 @@ static Request stopTransform(StopTransformRequest stopRequest) {

static Request previewTransform(PreviewTransformRequest previewRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms", "_preview")
.addPathPartAsIs("_transform", "_preview")
.build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
request.setEntity(createEntity(previewRequest, REQUEST_BODY_CONTENT_TYPE));
Expand All @@ -150,7 +150,7 @@ static Request previewTransform(PreviewTransformRequest previewRequest) throws I

static Request getTransformStats(GetTransformStatsRequest statsRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_frame", "transforms")
.addPathPartAsIs("_transform")
.addPathPart(statsRequest.getId())
.addPathPartAsIs("_stats")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.elasticsearch.client.core.PageParams;
import org.elasticsearch.client.transform.TransformNamedXContentProvider;
import org.elasticsearch.client.transform.DeleteTransformRequest;
import org.elasticsearch.client.transform.GetTransformRequest;
import org.elasticsearch.client.transform.GetTransformStatsRequest;
import org.elasticsearch.client.transform.PreviewTransformRequest;
import org.elasticsearch.client.transform.PutTransformRequest;
import org.elasticsearch.client.transform.StartTransformRequest;
import org.elasticsearch.client.transform.StopTransformRequest;
import org.elasticsearch.client.transform.TransformNamedXContentProvider;
import org.elasticsearch.client.transform.UpdateTransformRequest;
import org.elasticsearch.client.transform.transforms.TransformConfig;
import org.elasticsearch.client.transform.transforms.TransformConfigTests;
Expand All @@ -56,7 +56,7 @@
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.not;

public class DataFrameRequestConvertersTests extends ESTestCase {
public class TransformRequestConvertersTests extends ESTestCase {

@Override
protected NamedXContentRegistry xContentRegistry() {
Expand All @@ -72,7 +72,7 @@ public void testPutDataFrameTransform() throws IOException {
Request request = TransformRequestConverters.putTransform(putRequest);
assertThat(request.getParameters(), not(hasKey("defer_validation")));
assertEquals(HttpPut.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/" + putRequest.getConfig().getId()));
assertThat(request.getEndpoint(), equalTo("/_transform/" + putRequest.getConfig().getId()));

try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) {
TransformConfig parsedConfig = TransformConfig.PARSER.apply(parser, null);
Expand All @@ -91,7 +91,7 @@ public void testUpdateDataFrameTransform() throws IOException {
Request request = TransformRequestConverters.updateTransform(updateDataFrameTransformRequest);
assertThat(request.getParameters(), not(hasKey("defer_validation")));
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/" + transformId + "/_update"));
assertThat(request.getEndpoint(), equalTo("/_transform/" + transformId + "/_update"));

try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) {
TransformConfigUpdate parsedConfig = TransformConfigUpdate.fromXContent(parser);
Expand All @@ -108,7 +108,7 @@ public void testDeleteDataFrameTransform() {
Request request = TransformRequestConverters.deleteTransform(deleteRequest);

assertEquals(HttpDelete.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/foo"));
assertThat(request.getEndpoint(), equalTo("/_transform/foo"));

assertThat(request.getParameters(), not(hasKey("force")));

Expand All @@ -128,7 +128,7 @@ public void testStartDataFrameTransform() {

Request request = TransformRequestConverters.startTransform(startRequest);
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/" + startRequest.getId() + "/_start"));
assertThat(request.getEndpoint(), equalTo("/_transform/" + startRequest.getId() + "/_start"));

if (timeValue != null) {
assertTrue(request.getParameters().containsKey("timeout"));
Expand All @@ -152,7 +152,7 @@ public void testStopDataFrameTransform() {

Request request = TransformRequestConverters.stopTransform(stopRequest);
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/" + stopRequest.getId() + "/_stop"));
assertThat(request.getEndpoint(), equalTo("/_transform/" + stopRequest.getId() + "/_stop"));

if (waitForCompletion != null) {
assertTrue(request.getParameters().containsKey("wait_for_completion"));
Expand Down Expand Up @@ -180,7 +180,7 @@ public void testPreviewDataFrameTransform() throws IOException {
Request request = TransformRequestConverters.previewTransform(previewRequest);

assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/_preview"));
assertThat(request.getEndpoint(), equalTo("/_transform/_preview"));

try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) {
TransformConfig parsedConfig = TransformConfig.PARSER.apply(parser, null);
Expand All @@ -193,7 +193,7 @@ public void testGetDataFrameTransformStats() {
Request request = TransformRequestConverters.getTransformStats(getStatsRequest);

assertEquals(HttpGet.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/foo/_stats"));
assertThat(request.getEndpoint(), equalTo("/_transform/foo/_stats"));

assertFalse(request.getParameters().containsKey("from"));
assertFalse(request.getParameters().containsKey("size"));
Expand Down Expand Up @@ -223,7 +223,7 @@ public void testGetDataFrameTransform() {
Request request = TransformRequestConverters.getTransform(getRequest);

assertEquals(HttpGet.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/bar"));
assertThat(request.getEndpoint(), equalTo("/_transform/bar"));

assertFalse(request.getParameters().containsKey("from"));
assertFalse(request.getParameters().containsKey("size"));
Expand Down Expand Up @@ -253,6 +253,6 @@ public void testGetDataFrameTransform_givenMulitpleIds() {
Request request = TransformRequestConverters.getTransform(getRequest);

assertEquals(HttpGet.METHOD_NAME, request.getMethod());
assertThat(request.getEndpoint(), equalTo("/_data_frame/transforms/foo,bar,baz"));
assertThat(request.getEndpoint(), equalTo("/_transform/foo,bar,baz"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
import org.elasticsearch.client.transform.StopTransformResponse;
import org.elasticsearch.client.transform.UpdateTransformRequest;
import org.elasticsearch.client.transform.UpdateTransformResponse;
import org.elasticsearch.client.transform.transforms.TransformIndexerStats;
import org.elasticsearch.client.transform.transforms.TransformConfig;
import org.elasticsearch.client.transform.transforms.TransformConfigUpdate;
import org.elasticsearch.client.transform.transforms.TransformProgress;
import org.elasticsearch.client.transform.transforms.TransformStats;
import org.elasticsearch.client.transform.transforms.DestConfig;
import org.elasticsearch.client.transform.transforms.NodeAttributes;
import org.elasticsearch.client.transform.transforms.QueryConfig;
import org.elasticsearch.client.transform.transforms.SourceConfig;
import org.elasticsearch.client.transform.transforms.TimeSyncConfig;
import org.elasticsearch.client.transform.transforms.TransformConfig;
import org.elasticsearch.client.transform.transforms.TransformConfigUpdate;
import org.elasticsearch.client.transform.transforms.TransformIndexerStats;
import org.elasticsearch.client.transform.transforms.TransformProgress;
import org.elasticsearch.client.transform.transforms.TransformStats;
import org.elasticsearch.client.transform.transforms.pivot.AggregationConfig;
import org.elasticsearch.client.transform.transforms.pivot.GroupConfig;
import org.elasticsearch.client.transform.transforms.pivot.PivotConfig;
Expand Down Expand Up @@ -219,7 +219,7 @@ public void onFailure(Exception e) {
}
}

public void testUpdateDataFrameTransform() throws IOException, InterruptedException {
public void testUpdateTransform() throws IOException, InterruptedException {
createIndex("source-data");

RestHighLevelClient client = highLevelClient();
Expand Down
2 changes: 1 addition & 1 deletion docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ buildRestTests.setups['simple_kibana_continuous_pivot'] = buildRestTests.setups[
- do:
raw:
method: PUT
path: _data_frame/transforms/simple-kibana-ecomm-pivot
path: _transform/simple-kibana-ecomm-pivot
body: >
{
"source": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/transform/api-quickref.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All {transform} endpoints have the following base:

[source,js]
----
/_data_frame/transforms/
_transform/
----
// NOTCONSOLE

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/transform/apis/delete-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beta[]
[[delete-transform-request]]
==== {api-request-title}

`DELETE _data_frame/transforms/<transform_id>`
`DELETE _transform/<transform_id>`

[[delete-transform-prereqs]]
==== {api-prereq-title}
Expand Down Expand Up @@ -46,7 +46,7 @@ current state. The default value is `false`, meaning that the {transform} must b

[source,console]
--------------------------------------------------
DELETE _data_frame/transforms/ecommerce_transform
DELETE _transform/ecommerce_transform
--------------------------------------------------
// TEST[skip:setup kibana sample data]

Expand Down
14 changes: 7 additions & 7 deletions docs/reference/transform/apis/get-transform-stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ beta[]
[[get-transform-stats-request]]
==== {api-request-title}

`GET _data_frame/transforms/<transform_id>/_stats`
`GET _transform/<transform_id>/_stats`

`GET _data_frame/transforms/<transform_id>,<transform_id>/_stats` +
`GET _transform/<transform_id>,<transform_id>/_stats` +

`GET _data_frame/transforms/_stats` +
`GET _transform/_stats` +

`GET _data_frame/transforms/_all/_stats` +
`GET _transform/_all/_stats` +

`GET _data_frame/transforms/*/_stats` +
`GET _transform/*/_stats` +


[[get-transform-stats-prereqs]]
Expand Down Expand Up @@ -102,7 +102,7 @@ gets usage information for a maximum of ten results:

[source,console]
--------------------------------------------------
GET _data_frame/transforms/_stats?from=5&size=10
GET _transform/_stats?from=5&size=10
--------------------------------------------------
// TEST[skip:todo]

Expand All @@ -111,7 +111,7 @@ The following example gets usage information for the `ecommerce_transform`

[source,console]
--------------------------------------------------
GET _data_frame/transforms/ecommerce_transform/_stats
GET _transform/ecommerce_transform/_stats
--------------------------------------------------
// TEST[skip:todo]

Expand Down
14 changes: 7 additions & 7 deletions docs/reference/transform/apis/get-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ beta[]
[[get-transform-request]]
==== {api-request-title}

`GET _data_frame/transforms/<transform_id>` +
`GET _transform/<transform_id>` +

`GET _data_frame/transforms/<transform_id>,<transform_id>` +
`GET _transform/<transform_id>,<transform_id>` +

`GET _data_frame/transforms/` +
`GET _transform/` +

`GET _data_frame/transforms/_all` +
`GET _transform/_all` +

`GET _data_frame/transforms/*`
`GET _transform/*`

[[get-transform-prereqs]]
==== {api-prereq-title}
Expand Down Expand Up @@ -95,7 +95,7 @@ The following example retrieves information about a maximum of ten {transforms}:

[source,console]
--------------------------------------------------
GET _data_frame/transforms?size=10
GET _transform?size=10
--------------------------------------------------
// TEST[skip:setup kibana sample data]

Expand All @@ -104,7 +104,7 @@ The following example gets configuration information for the

[source,console]
--------------------------------------------------
GET _data_frame/transforms/ecommerce_transform
GET _transform/ecommerce_transform
--------------------------------------------------
// TEST[skip:setup kibana sample data]

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/transform/apis/preview-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beta[]
[[preview-transform-request]]
==== {api-request-title}

`POST _data_frame/transforms/_preview`
`POST _transform/_preview`

[[preview-transform-prereq]]
==== {api-prereq-title}
Expand Down Expand Up @@ -68,7 +68,7 @@ on all the current data in the source index.

[source,console]
--------------------------------------------------
POST _data_frame/transforms/_preview
POST _transform/_preview
{
"source": {
"index": "kibana_sample_data_ecommerce"
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/transform/apis/put-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beta[]
[[put-transform-request]]
==== {api-request-title}

`PUT _data_frame/transforms/<transform_id>`
`PUT _transform/<transform_id>`

[[put-transform-prereqs]]
==== {api-prereq-title}
Expand Down Expand Up @@ -139,7 +139,7 @@ delays.

[source,console]
--------------------------------------------------
PUT _data_frame/transforms/ecommerce_transform
PUT _transform/ecommerce_transform
{
"source": {
"index": "kibana_sample_data_ecommerce",
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/transform/apis/start-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beta[]
[[start-transform-request]]
==== {api-request-title}

`POST _data_frame/transforms/<transform_id>/_start`
`POST _transform/<transform_id>/_start`

[[start-transform-prereqs]]
==== {api-prereq-title}
Expand Down Expand Up @@ -62,7 +62,7 @@ required privileges on the source and destination indices, the

[source,console]
--------------------------------------------------
POST _data_frame/transforms/ecommerce_transform/_start
POST _transform/ecommerce_transform/_start
--------------------------------------------------
// TEST[skip:set up kibana samples]

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/transform/apis/stop-transform.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ beta[]
[[stop-transform-request]]
==== {api-request-title}

`POST _data_frame/transforms/<transform_id>/_stop` +
`POST _transform/<transform_id>/_stop` +

`POST _data_frame/transforms/<transform_id1>,<transform_id2>/_stop` +
`POST _transform/<transform_id1>,<transform_id2>/_stop` +

`POST _data_frame/transforms/_all/_stop`
`POST _transform/_all/_stop`


[[stop-transform-prereq]]
Expand Down Expand Up @@ -104,7 +104,7 @@ are no matches or only partial matches.

[source,console]
--------------------------------------------------
POST _data_frame/transforms/ecommerce_transform/_stop
POST _transform/ecommerce_transform/_stop
--------------------------------------------------
// TEST[skip:set up kibana samples]

Expand Down
Loading

0 comments on commit 5e0e54f

Please sign in to comment.