diff --git a/server/src/main/java/org/elasticsearch/ingest/FieldInferenceBulkRequestPreprocessor.java b/server/src/main/java/org/elasticsearch/ingest/FieldInferenceBulkRequestPreprocessor.java index 56c8b710cd965..adbb51f682fc3 100644 --- a/server/src/main/java/org/elasticsearch/ingest/FieldInferenceBulkRequestPreprocessor.java +++ b/server/src/main/java/org/elasticsearch/ingest/FieldInferenceBulkRequestPreprocessor.java @@ -145,7 +145,7 @@ private void runInferenceForFields( String fieldName = fieldNames.get(0); List nextFieldNames = fieldNames.subList(1, fieldNames.size()); final String fieldValue = ingestDocument.getFieldValue(fieldName, String.class); - Object existingInference = ingestDocument.getFieldValue(SemanticTextInferenceFieldMapper.FIELD_NAME + "." + fieldName, Object.class, true); + Object existingInference = ingestDocument.getFieldValue(fieldName + "." + SemanticTextFieldMapper.SPARSE_VECTOR_SUBFIELD_NAME, Object.class, true); if (fieldValue == null || existingInference != null) { // Run inference for next field logger.info("Skipping inference for field [" + fieldName + "]"); 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 c773617569cc9..9d21cbe929fcd 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,7 +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.index.mapper.SemanticTextFieldMapper; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.search.lookup.SourceFilter; import org.elasticsearch.xcontent.ParseField; @@ -126,7 +126,7 @@ public static FetchSourceContext parseFromRestRequest(RestRequest request) { return FetchSourceContext.of(fetchSource == null || fetchSource, sourceIncludes, sourceExcludes); } - return FetchSourceContext.of(true, null, new String[]{SemanticTextInferenceFieldMapper.FIELD_NAME}); + return FetchSourceContext.of(true, null, new String[]{"*." + SemanticTextFieldMapper.SPARSE_VECTOR_SUBFIELD_NAME}); } public static FetchSourceContext fromXContent(XContentParser parser) throws IOException {