Skip to content
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

Enable Partial Flat Object #7997

Merged
merged 5 commits into from
Jul 7, 2023

Conversation

mingshl
Copy link
Contributor

@mingshl mingshl commented Jun 9, 2023

Description

Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.

The main idea is to remember the flat object field name as mappedFieldTypeName in the dynamic created field (only in query time and it will vanish after returning result), which helps the logic to identify the starting point of a flat object, to decide if a query contains a dot path after flat object field name.

In the example given in the issue,

issue.label is defined as a flat_object, so issue.labels is the flat object field name, andissue.label.comment contains a dot path after the flat_object field name .

Related Issues

#7136

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT:
  • URL:
  • CommitID: b78a505
    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?

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.search.backpressure.SearchBackpressureIT.testSearchShardTaskCancellationWithHighCpu
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testPitCreatedOnReplica
      1 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure

@codecov
Copy link

codecov bot commented Jun 10, 2023

Codecov Report

Merging #7997 (e9a25c7) into main (c1c23b4) will increase coverage by 0.07%.
The diff coverage is 87.65%.

@@             Coverage Diff              @@
##               main    #7997      +/-   ##
============================================
+ Coverage     70.90%   70.97%   +0.07%     
- Complexity    56903    56939      +36     
============================================
  Files          4758     4758              
  Lines        269225   269234       +9     
  Branches      39407    39403       -4     
============================================
+ Hits         190881   191092     +211     
+ Misses        62256    62041     -215     
- Partials      16088    16101      +13     
Impacted Files Coverage Δ
...opensearch/index/translog/NoOpTranslogManager.java 63.63% <0.00%> (-1.99%) ⬇️
...search/index/shard/RemoteStoreRefreshListener.java 82.84% <66.66%> (-1.16%) ⬇️
...opensearch/index/mapper/FlatObjectFieldMapper.java 54.25% <80.00%> (+10.06%) ⬆️
...va/org/opensearch/index/store/RemoteDirectory.java 88.37% <87.50%> (-0.52%) ⬇️
...h/cluster/metadata/MetadataCreateIndexService.java 79.64% <100.00%> (-0.11%) ⬇️
...earch/index/store/RemoteSegmentStoreDirectory.java 92.09% <100.00%> (+0.17%) ⬆️
...search/index/translog/InternalTranslogManager.java 72.02% <100.00%> (+0.19%) ⬆️

... and 470 files with indirect coverage changes

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.search.backpressure.SearchBackpressureIT.testSearchTaskCancellationWithHighCpu
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testCancelPrimaryAllocation
      1 org.opensearch.cluster.allocation.AwarenessAllocationIT.testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness

@mingshl
Copy link
Contributor Author

mingshl commented Jun 13, 2023

PR Ready for reviews and comments @reta @dblock

@owaiskazi19
Copy link
Member

@mingshl can you add tests for the new changes?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testNodeDropWithOngoingReplication

@macohen
Copy link
Contributor

macohen commented Jul 6, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

Gradle Check (Jenkins) Run Completed with:

@mingshl mingshl requested a review from reta July 6, 2023 22:21
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.index.shard.RemoteStoreRefreshListenerTests.testRefreshSuccessOnThirdAttemptAttempt

@tlfeng tlfeng merged commit d333cd3 into opensearch-project:main Jul 7, 2023
7 checks passed
@mingshl mingshl self-assigned this Jul 7, 2023
@mingshl mingshl added v2.9.0 'Issues and PRs related to version v2.9.0' backport 2.x Backport to 2.x branch labels Jul 7, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 7, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
(cherry picked from commit d333cd3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
reta pushed a commit that referenced this pull request Jul 7, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------


(cherry picked from commit d333cd3)

Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
vikasvb90 pushed a commit to raghuvanshraj/OpenSearch that referenced this pull request Jul 12, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
raghuvanshraj pushed a commit to raghuvanshraj/OpenSearch that referenced this pull request Jul 12, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
dzane17 pushed a commit to dzane17/OpenSearch that referenced this pull request Jul 12, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
buddharajusahil pushed a commit to buddharajusahil/OpenSearch that referenced this pull request Jul 18, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: sahil buddharaju <[email protected]>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
Before this PR, flat_object can only be defined at the root field of JSON object in 2.7 and 2.8, because the json object is flatten so it lost the structure of a tree. Now, this PR enables json object to be partially mapped as flat_object field type while other fields in the JSON can be other field type.
---------

Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch Search Search query, autocomplete ...etc v2.9.0 'Issues and PRs related to version v2.9.0'
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants