From 010d302af3589aa66618c013a493915a4abb5362 Mon Sep 17 00:00:00 2001 From: carlosdelest Date: Wed, 1 Nov 2023 12:58:26 +0100 Subject: [PATCH] Add default source exclude for REST requests --- .../search/fetch/subphase/FetchSourceContext.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java index bba614dce78a5..c773617569cc9 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java @@ -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; @@ -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 {