Skip to content

Commit

Permalink
[Data-Frame] make the config be strictly parsed on _preview (elastic#…
Browse files Browse the repository at this point in the history
…39713)

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

* adding test to verify strictly parsing

* adjusting test after master merge
  • Loading branch information
benwtrent committed Mar 9, 2019
1 parent 8454cfc commit 0d925c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static Request fromXContent(final XContentParser parser) throws IOExcepti
.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));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}}
}
}

0 comments on commit 0d925c6

Please sign in to comment.