-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[RollupV2] Implement search resolution #67783
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
Closed
Closed
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
b768fbf
Rollup V2 Search Resolution Setup
talevy 793b807
Merge remote-tracking branch 'elastic/master' into rollupv2search
talevy 8ececef
fix compile errors
talevy c099033
Merge branch 'master' into rollupv2-search
csoulios 0d88290
Merge branch 'master' into rollupv2-search
csoulios 7824cef
Merged with master
csoulios 49d321e
Merge branch 'master' into rollupv2-search
csoulios 0ac4438
Merge branch 'master' into rollupv2-search
csoulios c74629d
Merge branch 'master' into rollupv2-search
csoulios 8f73c19
Merge branch 'master' into rollupv2-search
csoulios c889bb7
Fix build errors after merge with master
csoulios 7489dd7
WIP
csoulios d1ad022
Merge branch 'master' into rollupv2-search
csoulios bf82de1
Remove preFilterRollup param
csoulios 7512370
Merge branch 'master' into rollupv2-search
csoulios 54d78b2
WIP
csoulios 4e2ba19
resolve merge
talevy a21d676
add simple javaRestTest for rollup search
talevy 54c51c1
Merge remote-tracking branch 'elastic/master' into rollupv2-search
talevy c8fda40
Changed license to test file
csoulios 5de29cb
Merge branch 'master' into rollupv2-search
csoulios 9c0132d
Seems that there is a bug in the rollup action when indexing
csoulios 6f563f1
prepend rollup indices to backing datastream indices list
talevy b24f8ed
Merge remote-tracking branch 'elastic/master' into rollupv2-search
talevy 39ead9c
Added more tests
csoulios bff0eab
Added more tests
csoulios 3e5db50
Refactored RollupGroup class to include rollup metrics
csoulios 7a5fca6
Moved rollup metadata inside the datastream metadata.
csoulios e741f22
Merge branch 'master' into rollup-metadata-ds
csoulios a22ade9
Moved rollup metadata inside the datastream metadata - Part 2.
csoulios 387c587
Merge branch 'master' into rollup-metadata-ds
csoulios 314618c
Checkstyle fixes
csoulios 44defef
Made instance var final
csoulios 454d4ed
Minor cleanup
csoulios ba70d3a
Merge branch 'master' into rollupv2-search
csoulios ca6f6cf
Changed license
csoulios 787ad2d
Merge branch 'master' into rollupv2-search
csoulios 50ba142
Merge branch 'rollup-metadata-ds' into rollupv2-search-change-meta
csoulios 0a826d3
Merge branch 'master' into rollupv2-search-change-meta
csoulios 9494006
Merge branch 'master' into rollupv2-search-change-meta
csoulios 1c18dcd
Moved resolving optimal index to the coordinator part
csoulios 7136a1b
Merge branch 'master' into rollupv2-search
csoulios f43e821
Added test for rolluping up datastream indices
csoulios 2d61b3c
Code cleanup - Added more tests
csoulios e87c66f
Merge branch 'master' into rollupv2-search
csoulios f688baf
cleanup
csoulios 28b7035
Removed method that was not used in AggregatorFactories
csoulios e4f85d6
Deleted RollupMetadata and RollupGroup classes
csoulios 712ca29
Addressed reviewer comments
csoulios cc2bb5c
Added some unit tests for RollupShardDecider (more to follow)
csoulios 53dd12a
checkstyle
csoulios 9d5cefd
Added more unit tests for RollupShardDecider
csoulios 69fe706
Merge branch 'master' into rollupv2-search
csoulios 381fbed
Merge branch 'master' into rollupv2-search
csoulios 50b0b89
Minor change
csoulios ad1c045
Modify can_match phase so that index metadata
csoulios 14a537d
Modified CanMatchSearchPhaseResults class
csoulios b2aff7e
Added some unit tests for RollupShardDecider (more to follow)
csoulios 697de67
Merge branch 'master' into rollupv2-search
csoulios 7e7b3b4
Merge branch 'master' into rollupv2-search
csoulios 3d832dc
Merge branch 'master' into rollupv2-search
csoulios ab5a1a9
Removed RollupIndexMetadata class
csoulios 2ebbffa
Merge branch 'master' into rollupv2-search
csoulios a58df7a
Use IndexMetadata settings for determing rollup index
csoulios 1b29db2
Replaced index name with index uuid
csoulios ea4b5b6
Merge branch 'master' into rollupv2-search
csoulios 879a0fe
Fix typo
csoulios 56c10be
Fix broken test: CanMatchPreFilterSearchPhaseTests.testSortShards()
csoulios 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.block.ClusterBlockException; | ||
import org.elasticsearch.cluster.block.ClusterBlockLevel; | ||
import org.elasticsearch.cluster.metadata.DataStream; | ||
import org.elasticsearch.cluster.metadata.IndexAbstraction; | ||
import org.elasticsearch.cluster.metadata.IndexMetadata; | ||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
|
@@ -44,6 +46,7 @@ | |
import org.elasticsearch.index.query.Rewriteable; | ||
import org.elasticsearch.index.shard.ShardId; | ||
import org.elasticsearch.indices.breaker.CircuitBreakerService; | ||
import org.elasticsearch.rollup.RollupV2; | ||
import org.elasticsearch.search.SearchPhaseResult; | ||
import org.elasticsearch.search.SearchService; | ||
import org.elasticsearch.search.SearchShardTarget; | ||
|
@@ -710,9 +713,26 @@ static boolean shouldPreFilterSearchShards(ClusterState clusterState, | |
} else if (preFilterShardSize == null) { | ||
preFilterShardSize = SearchRequest.DEFAULT_PRE_FILTER_SHARD_SIZE; | ||
} | ||
if (RollupV2.isEnabled() && hasRollupDatastream(indices, searchRequest.indices(), clusterState)) { | ||
return true; | ||
} | ||
return searchRequest.searchType() == QUERY_THEN_FETCH // we can't do this for DFS it needs to fan out to all shards all the time | ||
&& (SearchService.canRewriteToMatchNone(source) || hasPrimaryFieldSort(source)) | ||
&& preFilterShardSize < numShards; | ||
&& (SearchService.canRewriteToMatchNone(source) || hasPrimaryFieldSort(source)) | ||
&& preFilterShardSize < numShards; | ||
} | ||
|
||
private static boolean hasRollupDatastream(String[] indices, String[] requestIndices, ClusterState clusterState) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not the logic that we need imo. |
||
Set<String> requestIndicesSet = Set.of(requestIndices); | ||
for (String index : indices) { | ||
IndexAbstraction originalIndex = clusterState.getMetadata().getIndicesLookup().get(index); | ||
DataStream datastream = originalIndex.getParentDataStream() != null | ||
? originalIndex.getParentDataStream().getDataStream() : null; | ||
IndexMetadata indexMetadata = clusterState.getMetadata().index(index); | ||
if (datastream != null && indexMetadata.isRollupIndex() && requestIndicesSet.contains(index) == false) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
private static boolean hasReadOnlyIndices(String[] indices, ClusterState clusterState) { | ||
|
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that we always run the can match phase if a datastream is present. No need to check the existence of rollups, the can match phase was made to handle datastreams before they existed ;).