-
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
Refactor QueryCollectorContext to improve extensibility #11778
Refactor QueryCollectorContext to improve extensibility #11778
Conversation
04bce0e
to
be0d6c8
Compare
❌ Gradle check result for 04bce0e: 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? |
Compatibility status:Checks if related components are compatible with change 021f593 Incompatible componentsSkipped componentsCompatible componentsCompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/sql.git] |
…ess public Signed-off-by: Martin Gaievski <gaievski@amazon.com>
27a54b9
to
021f593
Compare
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski Thanks for the details! I don't want to derail the conversation too much from @reta's original concerns but I do want to re-iterate my concern that all aggregations may not just work out of the box even if we do go ahead with the change in this PR. In that case we want to avoid a situation where today we open up these 2 methods and then later on you discover there are additional methods we also need to open up, etc. I think sharing a high level design for opensearch-project/neural-search#509 first would help us understand if this change is truly needed as well as any alternatives considered. |
I should go and reread the RFC (opensearch-project/neural-search#126) but just quick question on that: in general, CollectorManager could be using many collectors (MultiCollectorManager) so each one could produce own scores and reduce phase would return scores per collector type. Wouldn't it address the problem of wrapping up multiple scores per doc? |
❌ Gradle check result for 021f593: 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? |
❌ Gradle check result for 9acc035: 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? |
❕ Gradle check result for 27a54b9: UNSTABLE
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
This sounds interesting, I need to explorer this option. But before going deep into details can you help with few questions/concerns:
as a remark, with a multicollector approach collectors will be of the same type, just one per inner query. Hybrid query acts like a compound query, where any other query can be an inner query. |
Yes
No, you could use
I think the answer would be - probably not, aggregation are essentially a framework on top of collectors / collector managers that has own API. We may need a new time of the aggregator to design, if we have a gap there - we need to understand what is missing. |
Thanks @reta, providing this alternative. After reading the comments on the PR what I feel is we have changed the design of Aggregation for concurrent segment search and there has been some new interfaces that been added. Its worth looking into the new interfaces and see if it can solve the aggregations for hybrid query clause. As pointed out by @martin-gaievski that we will do some deep-dive and get back on this. But on a very high level if I have to provide whats the requirement here is:
Then with more testing we keep seeing if some changes are required in the already implemented aggregation flow to remove the issues in aggregation happening with Hybrid Query clause. Note: The Plugin Query phase searcher is called only if the hybrid query clause is a top level query clause, so the impact will be on the aggs with hybrid query clause and nothing else. |
I did some more deep-dive(Looked into ConcurrentQueryPhaseSearcher class, QueryCollectorManagerContext, CollectorManager and DefaultQueryPhaseSearcher) and here is what I can find:
Please let me know if there is gap in my understanding. Once the interfaces are opened up the way I see HybridQueryPhaseSearcher implementation getting changed is:
cc: @martin-gaievski , @vamshin |
thanks @navneet1v
This part I don't understand, any
Also, which I think is the most important thought to keep in mind: |
I'm checking Andriy's suggestion for using CollectorManager without creating custom context object. It looks promising so far, I built a small POC and basic sanity checks are passing for both aggregations and existing functionality of hybrid query. We may need to tweak few small things but overall it looks good, thanks for your input @reta cc: @navneet1v |
@reta Do you have any suggestion on following finding. if we call IndexSearcher.search(Query, CollectorManager) then there will be exception throwing from DefaultSearchContext.getTargetMaxSliceCount(), this is because two core aggregations my understanding is that in core system falls back to a non-concurrent search. Is there something that we can control from plugin side to avoid an exception and allow query to work in the same non-concurrent way? |
@martin-gaievski so the aggregations have this method
When search request comes in, it is being inspected, among other things, if there are any aggregations that are not compatible with concurrent search, and if yes, it delegates to nonconcurrent path. To answer your question - the |
@reta my understanding is that you are suggesting something like:
the problem is that for adding aggregation support to hybrid query we can only follow CollectorManager approach as direct calls to QueryContext has been locked, as per your initial explanation. So we'll be taking that approach independently of concurrent search being enabled or not. Do you mean that |
@martin-gaievski no, the decision is taken by
I think this is totally fine, I believe that the current implementation does not inspect |
@martin-gaievski I'm late to the discussion here but I wanted to mention that aggregation support for concurrent search is opt-in for each aggregator. See: OpenSearch/server/src/main/java/org/opensearch/search/aggregations/AggregatorFactory.java Lines 120 to 125 in 247e2ee
This is because plugins can provide their own Lines 122 to 126 in 247e2ee
|
got it @jed326, I see that for hybrid query we need to take that into account and have a flexibility to switch between concurrent/non-concurrent flow depending on how it's defined in each aggregator. I worked with @reta on possible approach, looks like we have found promising one that can provide following:
main idea is to add new collector manager before the QueryPhase.searchInternal and for non-concurrent search do collectorManager.reduce manually after |
This PR is stalled because it has been open for 30 days with no activity. |
This PR is stalled because it has been open for 30 days with no activity. |
Hey @martin-gaievski since aggregation support for hybrid queries has been implemented are we good to close this PR? |
Yes, let me close it |
Description
Methods
create
andpostProcess
in QueryCollectorContext cannot be called from outside of the package. That is limiting extensions for core OS in certain scenarios, as those methods need to be called for functionality like aggregation in search queries.In this PR I propose to change modifiers from default to
public
for methodscreate
andprosProcess
. Other changes are in implementing classes to adopt those changes in method signatures.Related Issues
While it's not directly related I came up with this PR in scope of opensearch-project/neural-search#509
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.