-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
OtherenhancementEnhancement or improvement to existing feature or requestEnhancement or improvement to existing feature or request
Description
Is your feature request related to a problem? Please describe
Fallow up of #20612
Usage of boolean constructor is redundant
OpenSearch/server/src/main/java/org/opensearch/search/fetch/subphase/FetchSourceContext.java
Line 80 in 59be6ae
| public FetchSourceContext(boolean fetchSource) { |
Since there are already the immutable objects:
OpenSearch/server/src/main/java/org/opensearch/search/fetch/subphase/FetchSourceContext.java
Line 67 in 59be6ae
| public static final FetchSourceContext FETCH_SOURCE = new FetchSourceContext(true); |
OpenSearch/server/src/main/java/org/opensearch/search/fetch/subphase/FetchSourceContext.java
Line 68 in 59be6ae
| public static final FetchSourceContext DO_NOT_FETCH_SOURCE = new FetchSourceContext(false); |
Extra (unnecessary) objects inflate the memory.
Describe the solution you'd like
Make the boolean constructor private and use FETCH_SOURCE and DO_NOT_FETCH_SOURCE
Related component
Other
Describe alternatives you've considered
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OtherenhancementEnhancement or improvement to existing feature or requestEnhancement or improvement to existing feature or request