Skip to content

Conversation

parkertimmins
Copy link
Contributor

Backport

This will backport the following commits from main to 8.18:

Questions ?

Please refer to the Backport tool documentation

…lastic#133611)

Flattened objects allow for keys with leading and trailing path separators (the period character .). They also allow field names consisting only of path separators. These fields names are then joined by the path separator and whole paths are stored with the associated value as key value pairs. The whole paths are then separated back into their component fields by splitting on the path separator. There is ambiguity whether a given period is meant as a path separator or part of a path name. Because of this, we assume that all periods are path separators. This means that any two adjacent periods in the whole path have an empty string field name between them. The same is true of leading and trailing periods. This is how we already handle adjacent periods that are at the front or middle of the whole path. But due to how the split function works, this is not how trailing adjacent periods are handled. By default the split function does not return trailing empty strings. By adding a negative limit to split, any trailing empty strings are now returned. Thus trailing adjacent periods are now treated the same as leading periods or periods in the middle of the string. More importantly, if the whole path consists of periods, the resulting path string was previously empty, causing an ArrayOutOfBoundsException. With this change, any paths consisting solely of periods will be treated has having empty string field names before and after every period.

Fixes elastic#130139

(cherry picked from commit 4661d06)

# Conflicts:
#	server/src/test/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldMapperTests.java
@parkertimmins parkertimmins added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Aug 27, 2025
@elasticsearchmachine elasticsearchmachine merged commit d74a55a into elastic:8.18 Aug 27, 2025
16 checks passed
@parkertimmins parkertimmins deleted the backport/8.18/pr-133611 branch August 27, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport v8.18.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants