[Data-Frame] make the config be strictly parsed on _preview (#39713) (#39873)

* [Data-Frame] make the config be strictly parsed on _preview

* adding test to verify strictly parsing

* adjusting test after master merge
This commit is contained in:
Benjamin Trent 2019-03-09 14:03:57 -06:00 committed by GitHub
parent 8454cfc1b2
commit 6c6549fc51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -65,7 +65,7 @@ public class PreviewDataFrameTransformAction extends Action<PreviewDataFrameTran
.createParser(parser.getXContentRegistry(),
LoggingDeprecationHandler.INSTANCE,
BytesReference.bytes(xContentBuilder).streamInput())) {
return new Request(DataFrameTransformConfig.fromXContent(newParser, "transform-preview", true));
return new Request(DataFrameTransformConfig.fromXContent(newParser, "transform-preview", false));
}
}

View File

@ -88,3 +88,17 @@ setup:
- match: { preview.2.airline: foo }
- match: { preview.2.by-hour: "2017-02-49 01" }
- match: { preview.2.avg_response: 42.0 }
---
"Test preview transform with invalid config":
- do:
catch: /\[data_frame_terms_group\] unknown field \[not_a_terms_param\]/
data_frame.preview_data_frame_transform:
body: >
{
"source": "airline-data",
"pivot": {
"group_by": {"airline": {"terms": {"not_a_terms_param": "airline"}}},
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}}
}
}