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

Avoid search_after short cutting in case of missing is specified #8391

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

gashutos
Copy link
Contributor

@gashutos gashutos commented Jul 1, 2023

Description

Fix for #8212.
If missing is specified in sort queries like below, it should result documents with null values as well in last. With #7453 optimizations of min/max values short cutting, this is breaking beucase if shard/segment has its min/max values out of search_after range but can still have missing values those are qualified for the output result.

{
	"size": 5,
	"sort": [{
		"amount_cents": {
			"order": "desc",
			"missing": "_last"
		}
	}, {
		"id": {
			"order": "desc",
			"missing": "_last"
		}
	}],
	"search_after": [150, "2"],
	"track_total_hits": false,
	"_source": false
}

Related Issues

Resolves #8212

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 Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.snapshots.RestoreSnapshotIT.testRestoreRemoteStoreIndicesWithoutRemoteTranslog
      1 org.opensearch.snapshots.RestoreSnapshotIT.testRestoreRemoteStoreIndicesWithRemoteTranslog
      1 org.opensearch.snapshots.RestoreSnapshotIT.testRestoreRemoteStoreIndicesWithRemoteTranslog
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testNodeDropWithOngoingReplication

@codecov
Copy link

codecov bot commented Jul 1, 2023

Codecov Report

Merging #8391 (2d25462) into main (665d237) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main    #8391      +/-   ##
============================================
- Coverage     70.95%   70.92%   -0.04%     
+ Complexity    56943    56937       -6     
============================================
  Files          4757     4757              
  Lines        269125   269125              
  Branches      39403    39403              
============================================
- Hits         190955   190872      -83     
- Misses        62079    62186     +107     
+ Partials      16091    16067      -24     
Impacted Files Coverage Δ
...main/java/org/opensearch/search/SearchService.java 71.90% <0.00%> (-0.77%) ⬇️

... and 448 files with indirect coverage changes

@gashutos
Copy link
Contributor Author

gashutos commented Jul 1, 2023

@dblock @reta when you guys get chance.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: gashutos <gashutos@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testNodeDropWithOngoingReplication
      2 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testDropPrimaryDuringReplication

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@reta reta merged commit 240193a into opensearch-project:main Jul 2, 2023
@reta reta added the backport 2.x Backport to 2.x branch label Jul 2, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 2, 2023
Signed-off-by: gashutos <gashutos@amazon.com>
(cherry picked from commit 240193a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@gashutos gashutos added backport 2.x Backport to 2.x branch and removed backport 2.x Backport to 2.x branch labels Jul 4, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8391-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 240193a8b129aaffffb39a57403264b8c4893efb
# Push it to GitHub
git push --set-upstream origin backport/backport-8391-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8391-to-2.x.

gashutos added a commit to gashutos/OpenSearch that referenced this pull request Jul 4, 2023
reta pushed a commit that referenced this pull request Jul 4, 2023
…) (#8432)

Signed-off-by: gashutos <gashutos@amazon.com>
buddharajusahil pushed a commit to buddharajusahil/OpenSearch that referenced this pull request Jul 18, 2023
…nsearch-project#8391)

Signed-off-by: gashutos <gashutos@amazon.com>
Signed-off-by: sahil buddharaju <sahilbud@amazon.com>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…nsearch-project#8391)

Signed-off-by: gashutos <gashutos@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
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 skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Regression in 2.8.0: sort with missing: _last omits results
3 participants