From ace17dd67473cde7111619a9d6444dd156857222 Mon Sep 17 00:00:00 2001 From: carlosdelest Date: Tue, 26 Mar 2024 13:31:25 +0100 Subject: [PATCH] PR feedback --- .../xpack/inference/mapper/InferenceResultFieldMapper.java | 1 + .../test/inference/10_semantic_text_inference.yml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/InferenceResultFieldMapper.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/InferenceResultFieldMapper.java index cb9b87f9935a2..a0065e2f1cf77 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/InferenceResultFieldMapper.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/InferenceResultFieldMapper.java @@ -150,6 +150,7 @@ public InferenceResultFieldMapper() { protected void parseCreateField(DocumentParserContext context) throws IOException { boolean withinLeafObject = context.path().isWithinLeafObject(); try { + // Disable dot expansion so there is no need to traverse subobjects for retrieving the field type context.path().setWithinLeafObject(true); XContentParser parser = context.parser(); failIfTokenIsNot(parser, XContentParser.Token.START_OBJECT); diff --git a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_inference.yml b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_inference.yml index 13b4d922dfc43..70ea12a45371f 100644 --- a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_inference.yml +++ b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_inference.yml @@ -337,9 +337,9 @@ setup: index: test-multifield-index id: doc_1 - - match: { _source.top_level_field: "multifield inference test" } - - match: { _source._inference.top_level_field\.semantic_multifield.results.0.text: "multifield inference test" } - - exists: _source._inference.top_level_field\.semantic_multifield.results.0.inference + - match: { _source.top_level_field: "multifield inference test" } + - length: { _source._inference.top_level_field\.semantic_multifield.results: 1 } + - match: { _source._inference.top_level_field\.semantic_multifield.results.0.text: "multifield inference test" } - exists: _source._inference.top_level_field\.semantic_multifield.results.0.inference