-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot #15126
Conversation
…field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com>
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
❌ Gradle check result for 94c912e: 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? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15126 +/- ##
============================================
- Coverage 71.84% 71.73% -0.11%
+ Complexity 62820 62701 -119
============================================
Files 5169 5169
Lines 294664 294666 +2
Branches 42615 42616 +1
============================================
- Hits 211691 211386 -305
- Misses 65530 65820 +290
- Partials 17443 17460 +17 ☔ View full report in Codecov by Sentry. |
server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
@reta, mind taking a second look at this PR? Thank you! |
Thanks a lot, @gaobinlong ! |
…field name containing only dot (#15126) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Optimize error message Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com> (cherry picked from commit 252742b) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…documents with field name containing only dot (#15188) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot (#15126) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Optimize error message Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com> (cherry picked from commit 252742b) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Update 120_field_name.yml Signed-off-by: Andriy Redko <andriy.redko@aiven.io> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Andriy Redko <andriy.redko@aiven.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
…field name containing only dot (opensearch-project#15126) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Optimize error message Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com>
…field name containing only dot (opensearch-project#15126) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Optimize error message Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com>
…field name containing only dot (opensearch-project#15126) * Fix array_index_out_of_bounds_exception when indexing documents with field name containing only dot Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Modify change log Signed-off-by: Gao Binlong <gbinlong@amazon.com> * Optimize error message Signed-off-by: Gao Binlong <gbinlong@amazon.com> --------- Signed-off-by: Gao Binlong <gbinlong@amazon.com>
Description
"." as field name yields
array_index_out_of_bounds_exception
, the reason is that we split the field name by.
here:OpenSearch/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
Line 208 in 49b7cd4
, if the field name contains only dot, the split result is an empty array, then yields that exception in this line:
OpenSearch/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
Line 1045 in 0cde7ba
Since
.
is reserved for object resolution, we can fail the indexing request when the field name contains only dot.Related Issues
Resolves #14911
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.