From f14bbea8feea7da677ad91ae58c85a9cef3750ea Mon Sep 17 00:00:00 2001 From: Mike Pellegrini Date: Wed, 11 Dec 2024 09:29:48 -0500 Subject: [PATCH] Restore original "is within leaf" value in SparseVectorFieldMapper (#118380) (#118457) --- docs/changelog/118380.yaml | 5 +++++ .../index/mapper/vectors/SparseVectorFieldMapper.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/118380.yaml diff --git a/docs/changelog/118380.yaml b/docs/changelog/118380.yaml new file mode 100644 index 000000000000..8b26c871fb17 --- /dev/null +++ b/docs/changelog/118380.yaml @@ -0,0 +1,5 @@ +pr: 118380 +summary: Restore original "is within leaf" value in `SparseVectorFieldMapper` +area: Mapping +type: bug +issues: [] diff --git a/server/src/main/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapper.java index d0a8dfae4f24..19ae649c12a8 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapper.java @@ -171,6 +171,7 @@ public void parse(DocumentParserContext context) throws IOException { ); } + final boolean isWithinLeaf = context.path().isWithinLeafObject(); String feature = null; try { // make sure that we don't expand dots in field names while parsing @@ -205,7 +206,7 @@ public void parse(DocumentParserContext context) throws IOException { context.addToFieldNames(fieldType().name()); } } finally { - context.path().setWithinLeafObject(false); + context.path().setWithinLeafObject(isWithinLeaf); } }