-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Implementation for enabling intra-segment search #19704
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
Merged
prudhvigodithi
merged 63 commits into
opensearch-project:main
from
prudhvigodithi:approx
Jan 29, 2026
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
150172b
Initial commit intra segment
prudhvigodithi 0aa7695
intra segment
prudhvigodithi 1056140
intra segment, update default values
prudhvigodithi 73fba5f
intra segment, update default values
prudhvigodithi 5ffd097
comment info logger
prudhvigodithi 019470b
Fix SubSearchContext
prudhvigodithi 49fd872
Default enable test
prudhvigodithi 5b03b2d
Test auto partition logic
prudhvigodithi ad9c5c6
Update LPT logic
prudhvigodithi 9b1d15f
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 5769681
Intra segment
prudhvigodithi a0254a3
disable logs
prudhvigodithi 77f633e
Intra segment, code cleanup
prudhvigodithi 4677272
Update cluster settings
prudhvigodithi aa60299
Update cluster settings
prudhvigodithi 9e88032
Update cluster settings
prudhvigodithi 6c013cd
Update cluster settings
prudhvigodithi 0e9cd66
Update cluster settings
prudhvigodithi 6c01ab8
code cleanup
prudhvigodithi c61e97d
Onboard intra segment decider and queries
prudhvigodithi d27e21d
Onboard intra segment decider and queries
prudhvigodithi 50293b8
Add java docs
prudhvigodithi bd06f77
Fix tests
prudhvigodithi d084d4a
Fix tests
prudhvigodithi ff87e7d
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 3f2917c
Default Enable
prudhvigodithi 9274fa3
Default Enable
prudhvigodithi c929afb
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi d208056
Support global agg
prudhvigodithi d6c0682
disable for start tree
prudhvigodithi 455ed13
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 9492d3d
Spotless fix
prudhvigodithi db432ca
Add partition strategy
prudhvigodithi 049be6b
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 6827e91
Upstream fetch
prudhvigodithi 67b20f0
code cleanup
prudhvigodithi 57b41fb
code cleanup
prudhvigodithi e3f16a2
Fix tests
prudhvigodithi f2e4734
Initial code for enabling intra
prudhvigodithi 9346e19
Initial code for enabling intra
prudhvigodithi ff6bb6b
Initial code for enabling intra
prudhvigodithi 8ff0c81
code refactor
prudhvigodithi ac940f4
code remove
prudhvigodithi 146909c
code remove
prudhvigodithi df9e25e
code remove
prudhvigodithi cd401b1
Add tests
prudhvigodithi ff1cb77
Update changelog
prudhvigodithi e749e79
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 63ffd57
Upstream fetch
prudhvigodithi 807c0cc
use balanced as default
prudhvigodithi 231a696
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 81ea6ff
address comments
prudhvigodithi 864da81
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 4b85551
Upstream fetch
prudhvigodithi e02800d
Change from none to segment
prudhvigodithi 3fd164c
Address PR comments
prudhvigodithi a8782b6
Address PR comments
prudhvigodithi 90505f3
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 677683c
Fix conflict
prudhvigodithi 5d4dcf6
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 31bdfdd
Fix conflict
prudhvigodithi 6bf2c10
Fix tests
prudhvigodithi 5880b11
Merge remote-tracking branch 'upstream/main' into approx
prudhvigodithi 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
73 changes: 73 additions & 0 deletions
73
server/src/internalClusterTest/java/org/opensearch/search/query/SpanNearQueryIT.java
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,73 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.search.query; | ||
|
|
||
| import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
|
|
||
| import org.opensearch.action.search.SearchResponse; | ||
| import org.opensearch.common.settings.Settings; | ||
| import org.opensearch.test.ParameterizedStaticSettingsOpenSearchIntegTestCase; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
|
|
||
| import static org.opensearch.index.query.QueryBuilders.spanNearQuery; | ||
| import static org.opensearch.index.query.QueryBuilders.spanTermQuery; | ||
| import static org.opensearch.search.SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING; | ||
| import static org.opensearch.search.SearchService.CONCURRENT_SEGMENT_SEARCH_PARTITION_MIN_SEGMENT_SIZE; | ||
| import static org.opensearch.search.SearchService.CONCURRENT_SEGMENT_SEARCH_PARTITION_STRATEGY; | ||
| import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount; | ||
|
|
||
| /** | ||
| * Integration tests for span_near queries with concurrent segment search and partition strategies. | ||
| */ | ||
| public class SpanNearQueryIT extends ParameterizedStaticSettingsOpenSearchIntegTestCase { | ||
|
|
||
| public SpanNearQueryIT(Settings staticSettings) { | ||
| super(staticSettings); | ||
| } | ||
|
|
||
| @ParametersFactory | ||
| public static Collection<Object[]> parameters() { | ||
| return Arrays.asList( | ||
| new Object[] { Settings.builder().put(CONCURRENT_SEGMENT_SEARCH_PARTITION_STRATEGY.getKey(), "segment").build() }, | ||
| new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }, | ||
| new Object[] { | ||
| Settings.builder() | ||
| .put(CONCURRENT_SEGMENT_SEARCH_PARTITION_STRATEGY.getKey(), "force") | ||
| .put(CONCURRENT_SEGMENT_SEARCH_PARTITION_MIN_SEGMENT_SIZE.getKey(), 1000) | ||
| .build() }, | ||
| new Object[] { | ||
| Settings.builder() | ||
| .put(CONCURRENT_SEGMENT_SEARCH_PARTITION_STRATEGY.getKey(), "balanced") | ||
| .put(CONCURRENT_SEGMENT_SEARCH_PARTITION_MIN_SEGMENT_SIZE.getKey(), 1000) | ||
| .build() } | ||
| ); | ||
| } | ||
|
|
||
| public void testSpanNearQuery() throws Exception { | ||
| createIndex("test", Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0).build()); | ||
| int totalDocs = 2500; | ||
| for (int i = 0; i < totalDocs; i++) { | ||
| String content = (i % 100 == 0) ? "alpha beta" : (i % 50 == 0) ? "alpha gamma beta" : "other words " + i; | ||
| client().prepareIndex("test").setId(String.valueOf(i)).setSource("field", content).get(); | ||
| } | ||
| refresh(); | ||
| forceMerge(1); | ||
| indexRandomForConcurrentSearch("test"); | ||
| SearchResponse response = client().prepareSearch("test") | ||
| .setQuery(spanNearQuery(spanTermQuery("field", "alpha"), 0).addClause(spanTermQuery("field", "beta")).inOrder(true)) | ||
| .get(); | ||
| assertHitCount(response, 25L); | ||
| response = client().prepareSearch("test") | ||
| .setQuery(spanNearQuery(spanTermQuery("field", "alpha"), 1).addClause(spanTermQuery("field", "beta")).inOrder(true)) | ||
| .get(); | ||
| assertHitCount(response, 50L); | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.