From a0d8814345ccdac0d95b10bcfa3a3e217ac1fef7 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 12 Mar 2019 11:03:22 +0000 Subject: [PATCH] Use data frame transform in docs and rename test classes --- ...aFrameIT.java => DataFrameTransformIT.java} | 10 +++++++++- ... => DataFrameTransformDocumentationIT.java} | 2 +- .../dataframe/delete_data_frame.asciidoc | 2 +- .../dataframe/put_data_frame.asciidoc | 18 +++++++++--------- 4 files changed, 20 insertions(+), 12 deletions(-) rename client/rest-high-level/src/test/java/org/elasticsearch/client/{DataFrameIT.java => DataFrameTransformIT.java} (87%) rename client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/{DataFrameDocumentationIT.java => DataFrameTransformDocumentationIT.java} (99%) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameTransformIT.java similarity index 87% rename from client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameIT.java rename to client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameTransformIT.java index 870395ebb7340..c3055ba819836 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/DataFrameTransformIT.java @@ -19,6 +19,7 @@ package org.elasticsearch.client; +import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.client.core.AcknowledgedResponse; import org.elasticsearch.client.dataframe.DeleteDataFrameTransformRequest; import org.elasticsearch.client.dataframe.PutDataFrameTransformRequest; @@ -39,8 +40,9 @@ import java.util.Collections; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.hamcrest.Matchers.containsString; -public class DataFrameIT extends ESRestHighLevelClientTestCase { +public class DataFrameTransformIT extends ESRestHighLevelClientTestCase { private void createIndex(String indexName) throws IOException { @@ -87,6 +89,12 @@ public void testCreateDelete() throws IOException { ack = execute(new DeleteDataFrameTransformRequest(transform.getId()), client::deleteDataFrameTransform, client::deleteDataFrameTransformAsync); assertTrue(ack.isAcknowledged()); + + // The second delete should fail + ElasticsearchStatusException deleteError = expectThrows(ElasticsearchStatusException.class, + () -> execute(new DeleteDataFrameTransformRequest(transform.getId()), client::deleteDataFrameTransform, + client::deleteDataFrameTransformAsync)); + assertThat(deleteError.getMessage(), containsString("Transform with id [test-crud] could not be found")); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameTransformDocumentationIT.java similarity index 99% rename from client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameDocumentationIT.java rename to client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameTransformDocumentationIT.java index ade91fc3fce2f..270f9c9da9db6 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/DataFrameTransformDocumentationIT.java @@ -47,7 +47,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -public class DataFrameDocumentationIT extends ESRestHighLevelClientTestCase { +public class DataFrameTransformDocumentationIT extends ESRestHighLevelClientTestCase { private void createIndex(String indexName) throws IOException { diff --git a/docs/java-rest/high-level/dataframe/delete_data_frame.asciidoc b/docs/java-rest/high-level/dataframe/delete_data_frame.asciidoc index 6f1ea07617c38..a60c98ce37b84 100644 --- a/docs/java-rest/high-level/dataframe/delete_data_frame.asciidoc +++ b/docs/java-rest/high-level/dataframe/delete_data_frame.asciidoc @@ -15,7 +15,7 @@ A +{request}+ object requires a non-null `id`. --------------------------------------------------- include-tagged::{doc-tests-file}[{api}-request] --------------------------------------------------- -<1> Constructing a new request referencing an existing {dataframe-job} +<1> Constructing a new request referencing an existing {dataframe-transform} include::../execution.asciidoc[] diff --git a/docs/java-rest/high-level/dataframe/put_data_frame.asciidoc b/docs/java-rest/high-level/dataframe/put_data_frame.asciidoc index c101f77cefd62..7f8b1b0e9fbf1 100644 --- a/docs/java-rest/high-level/dataframe/put_data_frame.asciidoc +++ b/docs/java-rest/high-level/dataframe/put_data_frame.asciidoc @@ -6,7 +6,7 @@ [id="{upid}-{api}"] === Put Data Frame Transform API -The Put Data Frame Transform API is used to create a new {dataframe-job}. +The Put Data Frame Transform API is used to create a new {dataframe-transform}. The API accepts a +{request}+ object as a request and returns a +{response}+. @@ -24,14 +24,14 @@ include-tagged::{doc-tests-file}[{api}-request] [id="{upid}-{api}-config"] ==== Data Frame Transform Configuration -The `DataFrameTransformConfig` object contains all the details about the {dataframe-job} +The `DataFrameTransformConfig` object contains all the details about the {dataframe-transform} configuration and contains the following arguments: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-config] -------------------------------------------------- -<1> The data frame transform ID +<1> The {dataframe-transform} ID <2> The source index or index pattern <3> The destination index <4> Optionally a QueryConfig @@ -40,7 +40,7 @@ include-tagged::{doc-tests-file}[{api}-config] [id="{upid}-{api}-query-config"] ==== QueryConfig -The query with which to select data from the source index. +The query with which to select data from the source. If not set a `match_all` query is used by default. ["source","java",subs="attributes,callouts,macros"] @@ -50,7 +50,7 @@ include-tagged::{doc-tests-file}[{api}-query-config] ==== PivotConfig -Defines the pivot transform `group by` fields and the aggregation to reduce the data. +Defines the pivot function `group by` fields and the aggregation to reduce the data. ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- @@ -59,12 +59,12 @@ include-tagged::{doc-tests-file}[{api}-pivot-config] ===== GroupConfig The grouping terms. Defines the group by and destination fields -which are produced by the grouping transform. There are 3 types of +which are produced by the pivot function. There are 3 types of groups * Terms * Histogram -* Date Historgram +* Date Histogram ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- @@ -76,7 +76,7 @@ include-tagged::{doc-tests-file}[{api}-group-config] ===== AggregationConfig Defines the aggregations for the group fields. -The aggregation must be one of `avg`, `min`, `max` or `sum`. +// TODO link to the supported aggregations ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- @@ -90,4 +90,4 @@ include::../execution.asciidoc[] ==== Response The returned +{response}+ acknowledges the successful creation of -the new {dataframe-job} or an error if the configuration is invalid. +the new {dataframe-transform} or an error if the configuration is invalid.