-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[BUG] Unused fetch sub phase processors initialized during fetch phase #12502
Copy link
Copy link
Closed
Copy link
Labels
Search:PerformancebugSomething isn't workingSomething isn't workingv2.13.0Issues and PRs related to version 2.13.0Issues and PRs related to version 2.13.0v3.0.0Issues and PRs related to version 3.0.0Issues and PRs related to version 3.0.0
Description
Describe the bug
Opensearch initializes sub processors even if are not getting used during the fetch phase. Can be prevented by validating if size of fields is greater than zero in addition to it being non-null. Take below snippet from InnerHitsPhase class:
public FetchSubPhaseProcessor getProcessor(FetchContext searchContext) {
if (searchContext.innerHits() == null) {
return null;
}
This should not get initialized if the innerHits count is 0
Related component
Search:Performance
To Reproduce
- Add data http_logs into Opensearch
- Run below query:
curl -XGET "http://localhost:9200/logs-241998/_search?pretty" -H 'Content-Type: application/json' -d'
{"size": 1000,
"query": {
"match_all": {}
},"docvalue_fields":["clientip"],
"sort": [{"size":"asc"}]
}'
- Attach debugger to above code reference
Expected behavior
Unnecessary initialization of fetch sub phase processor should be skipped
Additional Details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Search:PerformancebugSomething isn't workingSomething isn't workingv2.13.0Issues and PRs related to version 2.13.0Issues and PRs related to version 2.13.0v3.0.0Issues and PRs related to version 3.0.0Issues and PRs related to version 3.0.0
Type
Projects
Status
✅ Done
Status
No status