-
Notifications
You must be signed in to change notification settings - Fork 25.6k
add tests for missing aggregation #53214
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
Merged
andyb-elastic
merged 4 commits into
elastic:master
from
andyb-elastic:feature-missing-agg-tests
Mar 11, 2020
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/320_missing.yml
This file contains hidden or 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,98 @@ | ||
| setup: | ||
| - do: | ||
| indices.create: | ||
| index: test | ||
| body: | ||
| settings: | ||
| number_of_replicas: 0 | ||
| mappings: | ||
| properties: | ||
| field1: | ||
| type: long | ||
| field2: | ||
| type: long | ||
| field3: | ||
| type: long | ||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| body: | ||
| - index: | ||
| _index: test | ||
| - field1: 100 | ||
| - index: | ||
| _index: test | ||
| - field1: 200 | ||
| - index: | ||
| _index: test | ||
| - field1: 300 | ||
| field2: 300 | ||
|
|
||
| --- | ||
| "match all": | ||
|
|
||
| - do: | ||
| search: | ||
| rest_total_hits_as_int: true | ||
| body: | ||
| aggs: | ||
| missing_agg: | ||
| missing: | ||
| field: field3 | ||
|
|
||
| - match: { hits.total: 3 } | ||
| - length: { hits.hits: 3 } | ||
|
|
||
| - match: { aggregations.missing_agg.doc_count: 3 } | ||
|
|
||
| --- | ||
| "match some": | ||
|
|
||
| - do: | ||
| search: | ||
| rest_total_hits_as_int: true | ||
| body: | ||
| aggs: | ||
| missing_agg: | ||
| missing: | ||
| field: field2 | ||
|
|
||
| - match: { hits.total: 3 } | ||
| - length: { hits.hits: 3 } | ||
|
|
||
| - match: { aggregations.missing_agg.doc_count: 2 } | ||
|
|
||
| --- | ||
| "match none": | ||
|
|
||
| - do: | ||
| search: | ||
| rest_total_hits_as_int: true | ||
| body: | ||
| aggs: | ||
| missing_agg: | ||
| missing: | ||
| field: field1 | ||
|
|
||
| - match: { hits.total: 3 } | ||
| - length: { hits.hits: 3 } | ||
|
|
||
| - match: { aggregations.missing_agg.doc_count: 0 } | ||
|
|
||
| --- | ||
| "missing param": | ||
|
|
||
| - do: | ||
| search: | ||
| rest_total_hits_as_int: true | ||
| body: | ||
| aggs: | ||
| missing_agg: | ||
| missing: | ||
| field: field3 | ||
| missing: 1 | ||
|
|
||
| - match: { hits.total: 3 } | ||
| - length: { hits.hits: 3 } | ||
|
|
||
| - match: { aggregations.missing_agg.doc_count: 0 } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: in some of the aggregator tests similar to this one (where there's a second field we expect to be absent sometimes), we don't pass a field type for the second field like above. If the test is missing the second field type, that field can't be read even if an aggregator was erroneously trying to collect it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix that, could you open a ticket so we don't forget please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #53250