Skip to content

Commit

Permalink
Fix _source exclusions for this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Nov 8, 2023
1 parent 26befca commit 083ca80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void runInferenceForFields(
String fieldName = fieldNames.get(0);
List<String> 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 + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 083ca80

Please sign in to comment.