-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate stats formatting in standard InternalStats constructor (#107678
) We want to validate stats formatting before we serialize to XContent, as chunked x-content serialization assumes that we don't throw exceptions at that point. It is not necessary to do it in the StreamInput constructor as this one has been serialise from an already checked object. This commit adds starts formatting validation to the standard InternalStats constructor.
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 107678 | ||
summary: Validate stats formatting in standard `InternalStats` constructor | ||
area: Aggregations | ||
type: bug | ||
issues: | ||
- 107671 |
42 changes: 42 additions & 0 deletions
42
...c/yamlRestTest/resources/rest-api-spec/test/aggregations/stats_metric_fail_formatting.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_date | ||
body: | ||
mappings: | ||
properties: | ||
date_field: | ||
type : date | ||
format: date_hour_minute_second_millis | ||
|
||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test_date | ||
_id: "1" | ||
- date_field: 9999-01-01T00:00:00.000 | ||
- index: | ||
_index: test_date | ||
_id: "2" | ||
- date_field: 9999-01-01T00:00:00.000 | ||
|
||
--- | ||
"fail formatting": | ||
|
||
- skip: | ||
version: "- 8.14.99" | ||
reason: fixed in 8.15.0 | ||
- do: | ||
catch: /Cannot format stat \[sum\] with format \[DocValueFormat.DateTime\(format\[date_hour_minute_second_millis\] locale\[\], Z, MILLISECONDS\)\]/ | ||
search: | ||
index: test_date | ||
body: | ||
size: 0 | ||
aggs: | ||
the_stats: | ||
stats: | ||
field: date_field | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters