-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Handle missing and multiple values in script #29611
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
Closed
mayya-sharipova
wants to merge
11
commits into
elastic:master
from
mayya-sharipova:missing-and-multiple-values-in-script
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5aeab57
Handle missing and multiple values in script
mayya-sharipova 3b42f1f
Handle missing and multiple values in script
mayya-sharipova acceb90
Merge remote-tracking branch 'upstream/master' into missing-and-multi…
mayya-sharipova 44c2a2d
Merge branch 'master' into missing-and-multiple-values-in-script
mayya-sharipova 757fe0f
Handle missing and multiple values in script
mayya-sharipova f5fd421
Merge remote-tracking branch 'upstream/master' into missing-and-multi…
mayya-sharipova 359a000
Correct painless-getting-started for multi values
mayya-sharipova b0c891a
Set system property for test framework
mayya-sharipova 8e71522
Merge remote-tracking branch 'upstream/master' into missing-and-multi…
mayya-sharipova 3b5f421
Set system property for tests and update painless-getting-started
mayya-sharipova 8222111
Merge remote-tracking branch 'upstream/master' into missing-and-multi…
mayya-sharipova 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
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
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
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
117 changes: 117 additions & 0 deletions
117
...ainless/src/test/resources/rest-api-spec/test/painless/70_missing_and_multiple_values.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,117 @@ | ||
| setup: | ||
| - do: | ||
| indices.create: | ||
| index: test | ||
| body: | ||
| settings: | ||
| number_of_shards: 1 | ||
| mappings: | ||
| _doc: | ||
| properties: | ||
| dval: | ||
| type: double | ||
| lval: | ||
| type: long | ||
|
|
||
| - do: | ||
| index: | ||
| index: test | ||
| type: _doc | ||
| id: 1 | ||
| body: { "dval": 5.5, "lval": 5 } | ||
|
|
||
| - do: | ||
| index: | ||
| index: test | ||
| type: _doc | ||
| id: 2 | ||
| body: { "dval": [5.5, 3.5, 4.5] } | ||
|
|
||
|
|
||
| - do: | ||
| index: | ||
| index: test | ||
| type: _doc | ||
| id: 3 | ||
| body: { "lval": [5, 3, 4] } | ||
|
|
||
| - do: | ||
| indices.refresh: {} | ||
|
|
||
| --- | ||
| "check double and long values: missing values and operations on multiple values": | ||
| - skip: | ||
| version: " - 6.99.99" | ||
| reason: Handling missing values and operations on multiple values were added after these versions | ||
|
|
||
| - do: | ||
| search: | ||
| body: | ||
| script_fields: | ||
| val_dval: | ||
| script: | ||
| source: "doc['dval']?.value ?: -1.0" | ||
| min_dval: | ||
| script: | ||
| source: "doc['dval']?.min ?: -1.0" | ||
| max_dval: | ||
| script: | ||
| source: "doc['dval']?.max ?: -1.0" | ||
| sum_dval: | ||
| script: | ||
| source: "doc['dval']?.sum ?: -1.0" | ||
| avg_dval: | ||
| script: | ||
| source: "doc['dval']?.avg ?: -1.0" | ||
| val_lval: | ||
| script: | ||
| source: "doc['lval']?.value ?: -1" | ||
| min_lval: | ||
| script: | ||
| source: "doc['lval']?.min ?: -1" | ||
| max_lval: | ||
| script: | ||
| source: "doc['lval']?.max ?: -1" | ||
| sum_lval: | ||
| script: | ||
| source: "doc['lval']?.sum ?: -1" | ||
| avg_lval: | ||
| script: | ||
| source: "doc['lval']?.avg ?: -1" | ||
|
|
||
| - match: { hits.hits.0.fields.val_dval.0: 5.5} | ||
| - match: { hits.hits.0.fields.min_dval.0: 5.5} | ||
| - match: { hits.hits.0.fields.max_dval.0: 5.5} | ||
| - match: { hits.hits.0.fields.sum_dval.0: 5.5} | ||
| - match: { hits.hits.0.fields.avg_dval.0: 5.5} | ||
|
|
||
| - match: { hits.hits.0.fields.val_lval.0: 5} | ||
| - match: { hits.hits.0.fields.min_lval.0: 5} | ||
| - match: { hits.hits.0.fields.max_lval.0: 5} | ||
| - match: { hits.hits.0.fields.sum_lval.0: 5} | ||
| - match: { hits.hits.0.fields.avg_lval.0: 5} | ||
|
|
||
| - match: { hits.hits.1.fields.val_dval.0: 3.5} | ||
| - match: { hits.hits.1.fields.min_dval.0: 3.5} | ||
| - match: { hits.hits.1.fields.max_dval.0: 5.5} | ||
| - match: { hits.hits.1.fields.sum_dval.0: 13.5} | ||
| - match: { hits.hits.1.fields.avg_dval.0: 4.5} | ||
|
|
||
| - match: { hits.hits.1.fields.val_lval.0: -1} | ||
| - match: { hits.hits.1.fields.min_lval.0: -1} | ||
| - match: { hits.hits.1.fields.max_lval.0: -1} | ||
| - match: { hits.hits.1.fields.sum_lval.0: -1} | ||
| - match: { hits.hits.1.fields.avg_lval.0: -1} | ||
|
|
||
| - match: { hits.hits.2.fields.val_dval.0: -1.0} | ||
| - match: { hits.hits.2.fields.min_dval.0: -1.0} | ||
| - match: { hits.hits.2.fields.max_dval.0: -1.0} | ||
| - match: { hits.hits.2.fields.sum_dval.0: -1.0} | ||
| - match: { hits.hits.2.fields.avg_dval.0: -1.0} | ||
|
|
||
| - match: { hits.hits.2.fields.val_lval.0: 3} | ||
| - match: { hits.hits.2.fields.min_lval.0: 3} | ||
| - match: { hits.hits.2.fields.max_lval.0: 5} | ||
| - match: { hits.hits.2.fields.sum_lval.0: 12} | ||
| - match: { hits.hits.2.fields.avg_lval.0: 4} | ||
|
|
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
Oops, something went wrong.
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.
I'd edit the intro to:
Painless supports the following operations for multi-value numeric fields:
In the list, I'd drop "among values" from min & max. For sum and average, I'd probably say "of the values" rather than "of all values".
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.
@debadair thanks for the suggestion, noted