Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML][Data Frame] Adding bwc tests for pivot transform #43506

Merged
merged 13 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public DestConfig(String index, String pipeline) {

public DestConfig(final StreamInput in) throws IOException {
index = in.readString();
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
pipeline = in.readOptionalString();
} else {
pipeline = null;
Expand All @@ -72,7 +72,7 @@ public boolean isValid() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(index);
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
out.writeOptionalString(pipeline);
}
}
Expand Down
3 changes: 2 additions & 1 deletion x-pack/qa/rolling-upgrade/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ for (Version version : bwcVersions.wireCompatible) {
'mixed_cluster/30_ml_jobs_crud/Create a job in the mixed cluster and write some data',
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed in mixed cluster',
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed without aggs in mixed cluster',
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed with aggs in mixed cluster'
'mixed_cluster/40_ml_datafeed_crud/Put job and datafeed with aggs in mixed cluster',
'mixed_cluster/80_data_frame_jobs_crud/Test put mixed cluser data frame transform'
].join(',')
finalizedBy "${baseName}#oldClusterTestCluster#node1.stop"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
---
"Test put mixed cluser data frame transform":
- do:
indices.create:
index: mixed-dataframe-transform-airline-data
body:
mappings:
properties:
time:
type: date
airline:
type: keyword
responsetime:
type: float
event_rate:
type: integer
- do:
data_frame.put_data_frame_transform:
transform_id: "mixed-simple-transform"
body: >
{
"source": { "index": "mixed-dataframe-transform-airline-data" },
"dest": { "index": "mixed-simple-transform-idx" },
"pivot": {
"group_by": { "airline": {"terms": {"field": "airline"}}},
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}}
}
}
- match: { acknowledged: true }

- do:
data_frame.start_data_frame_transform:
transform_id: "mixed-simple-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "mixed-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "mixed-simple-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "mixed-simple-transform"
wait_for_completion: true
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform_stats:
transform_id: "mixed-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "mixed-simple-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }

- do:
data_frame.put_data_frame_transform:
transform_id: "mixed-complex-transform"
body: >
{
"source": {
"index": "mixed-dataframe-transform-airline-data",
"query": {
"bool": {
"filter": {"term": {"airline": "ElasticAir"}}
}
}
},
"dest": {
"index": "mixed-complex-transform-idx",
"pipeline": "data_frame_simple_pipeline"
},
"pivot": {
"group_by": {
"airline": {"terms": {"field": "airline"}},
"day": {"date_histogram": {"field": "timestamp", "calendar_interval": "1d"}},
"every_50": {"histogram": {"field": "responsetime", "interval": 50}}
},
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}}
}
}
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform:
transform_id: "mixed-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "mixed-complex-transform" }
- is_true: transforms.0.version
- is_true: transforms.0.create_time

- do:
data_frame.start_data_frame_transform:
transform_id: "mixed-complex-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "mixed-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "mixed-complex-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "mixed-complex-transform"
wait_for_completion: true
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform_stats:
transform_id: "mixed-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "mixed-complex-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }

- do:
cluster.health:
index: ".data-frame-internal-1"
wait_for_status: green
---
"Test GET, start, and stop old cluster transforms":
- do:
data_frame.get_data_frame_transform:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- match: { transforms.0.source.index.0: "old-dataframe-transform-airline-data" }
- match: { transforms.0.dest.index: "old-simple-transform-idx" }
- match: { transforms.0.pivot.group_by.airline.terms.field: "airline" }
- match: { transforms.0.pivot.aggregations.avg_response.avg.field: "responsetime" }

- do:
data_frame.start_data_frame_transform:
transform_id: "old-simple-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "old-simple-transform"
wait_for_completion: true
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }

- do:
data_frame.get_data_frame_transform:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }
- match: { transforms.0.source.index.0: "old-dataframe-transform-airline-data" }
- match: { transforms.0.dest.index: "old-complex-transform-idx" }
- match: { transforms.0.dest.pipeline: "data_frame_simple_pipeline" }
- match: { transforms.0.pivot.group_by.airline.terms.field: "airline" }
- match: { transforms.0.pivot.group_by.day.date_histogram.field: "timestamp" }
- match: { transforms.0.pivot.group_by.every_50.histogram.field: "responsetime" }
- match: { transforms.0.pivot.aggregations.avg_response.avg.field: "responsetime" }

- do:
data_frame.start_data_frame_transform:
transform_id: "old-complex-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "old-complex-transform"
wait_for_completion: true
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
"Test put data frame transforms on old cluster":
- do:
indices.create:
index: old-dataframe-transform-airline-data
body:
mappings:
properties:
time:
type: date
airline:
type: keyword
responsetime:
type: float
event_rate:
type: integer
- do:
ingest.put_pipeline:
id: "data_frame_simple_pipeline"
body: >
{
"processors": [
{
"set" : {
"field" : "my_field",
"value": 42
}
}
]
}
- do:
data_frame.put_data_frame_transform:
transform_id: "old-simple-transform"
body: >
{
"source": { "index": "old-dataframe-transform-airline-data" },
"dest": { "index": "old-simple-transform-idx" },
"pivot": {
"group_by": { "airline": {"terms": {"field": "airline"}}},
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}}
}
}
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- is_true: transforms.0.version
- is_true: transforms.0.create_time

- do:
data_frame.start_data_frame_transform:
transform_id: "old-simple-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "old-simple-transform"
wait_for_completion: true
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-simple-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-simple-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }

- do:
data_frame.put_data_frame_transform:
transform_id: "old-complex-transform"
body: >
{
"source": {
"index": "old-dataframe-transform-airline-data",
"query": {
"bool": {
"filter": {"term": {"airline": "ElasticAir"}}
}
}
},
"dest": {
"index": "old-complex-transform-idx",
"pipeline": "data_frame_simple_pipeline"
},
"pivot": {
"group_by": {
"airline": {"terms": {"field": "airline"}},
"day": {"date_histogram": {"field": "timestamp", "calendar_interval": "1d"}},
"every_50": {"histogram": {"field": "responsetime", "interval": 50}}
},
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}}
}
}
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }

- do:
data_frame.start_data_frame_transform:
transform_id: "old-complex-transform"
- match: { acknowledged: true }
- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }
- match: { transforms.0.state.task_state: "/started|stopped/" }

- do:
data_frame.stop_data_frame_transform:
transform_id: "old-complex-transform"
wait_for_completion: true
- match: { acknowledged: true }

- do:
data_frame.get_data_frame_transform_stats:
transform_id: "old-complex-transform"
- match: { count: 1 }
- match: { transforms.0.id: "old-complex-transform" }
- match: { transforms.0.state.indexer_state: "stopped" }
- match: { transforms.0.state.task_state: "stopped" }

- do:
cluster.health:
index: ".data-frame-internal-1"
wait_for_status: green
Loading