Skip to content

Commit

Permalink
Add default source exclude for REST requests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Nov 1, 2023
1 parent 1487362 commit 010d302
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.core.Booleans;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.mapper.SemanticTextInferenceFieldMapper;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.search.lookup.SourceFilter;
import org.elasticsearch.xcontent.ParseField;
Expand Down Expand Up @@ -124,7 +125,8 @@ public static FetchSourceContext parseFromRestRequest(RestRequest request) {
if (fetchSource != null || sourceIncludes != null || sourceExcludes != null) {
return FetchSourceContext.of(fetchSource == null || fetchSource, sourceIncludes, sourceExcludes);
}
return null;

return FetchSourceContext.of(true, null, new String[]{SemanticTextInferenceFieldMapper.FIELD_NAME});
}

public static FetchSourceContext fromXContent(XContentParser parser) throws IOException {
Expand Down

0 comments on commit 010d302

Please sign in to comment.