Validation of the _source to reject contradicting and ambiguous requests#20742
Validation of the _source to reject contradicting and ambiguous requests#20742urmichm wants to merge 15 commits intoopensearch-project:mainfrom
_source to reject contradicting and ambiguous requests#20742Conversation
PR Reviewer Guide 🔍(Review updated until commit 706f30b)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 706f30b Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 53120e7
Suggestions up to commit 7cb356d
Suggestions up to commit 0b4c2c8
Suggestions up to commit 9d97f05
Suggestions up to commit 68f6ccd
|
|
❌ Gradle check result for c2718e8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit 418c9b7 |
|
Persistent review updated to latest commit 8f222c4 |
|
Persistent review updated to latest commit 49d359c |
We should use |
fe8b28f to
7cb356d
Compare
|
Persistent review updated to latest commit 7cb356d |
7cb356d to
53120e7
Compare
|
Persistent review updated to latest commit 53120e7 |
|
thank you @gaobinlong ! |
|
❌ Gradle check result for 53120e7: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@urmichm , sorry for that, I think we need to change the skip version to |
|
And please merge the latest main branch into your branch, thanks! |
|
|
||
| package org.opensearch.search.fetch.subphase; | ||
|
|
||
| import org.opensearch.OpenSearchException; |
There was a problem hiding this comment.
Could you keep this PR as a pure refactor. And raise another PR for the change? That would be very helpful to the reviewer. I'm sure pure refactor will be merged quickly :)
Regarding the change, I notice you already think we cannot introduce breaking behavior for 3.x here, which I agree!
Unfortunately we don't have a 4.x branch so we cannot get the breaking change in. But at least we can use the deprecation log to capture the effort being spent here. At the time of 4.0, we should do a scan of all the deprecation logs and change to exceptions.
cc: @andrross
There was a problem hiding this comment.
Example
|
@gaobinlong @bowenlan-amzn Thank you for the feedback! |
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
extract array parsing as its own function Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
include and exclude collections must not contain the same entries Signed-off-by: Mikhail Urmich <urmich.m@gmail.com>
The same entry MUST NOT be present in both inludes AND excludes arrays. This leads to ambiguity. Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Explicitly defined source object '_source={}' not allowed
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
Signed-off-by: Mikhail Urmich <urmich.m@gmail.com>
Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
empty object validation updated to cover all possible cases Signed-off-by: Mikhail Urmich <m.urmich@jobware.de>
toXContent to create valid object Signed-off-by: Mikhail Urmich <urmich.m@gmail.com>
53120e7 to
706f30b
Compare
|
Persistent review updated to latest commit 706f30b |
|
❌ Gradle check result for 706f30b: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
Validation of the
_sourceobject added to avoid confusion and reject contradicting and ambiguous requests:"_source": {}At lease one ofincludesorexcludesmust be defined. 🚫"_source": []Explicitly defined empty array ofincludesis not allowed. 🚫"_source": { "includes": "text", "excludes": ["title", "text"] }Thetextfield is defined in bothincludesandexcludes. Contradiction. 🚫"_source": { "includes": [], "excludes": ["title"] }or_source: { "includes": ["title"], "excludes": [] }Explicitly defined empty arrays are not allowed to avoid confusion. 🚫To include the whole
_sourceobject or to exclude it completely, the existingbooleanlogic is encouraged."_source": trueand"_source": falseUnit tests added to test behaviour of parsing implementation.
Existing unit tests have been extended to cover invalid cases.
Related Issues
Resolves #20612
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.