Skip to content

Fix parsing of flattened fields within subobjects: false#105373

Merged
felixbarny merged 3 commits intoelastic:mainfrom
felixbarny:fix-flattened-subobjects-false
Feb 20, 2024
Merged

Fix parsing of flattened fields within subobjects: false#105373
felixbarny merged 3 commits intoelastic:mainfrom
felixbarny:fix-flattened-subobjects-false

Conversation

@felixbarny
Copy link
Copy Markdown
Member

DocumentParser#doParseObject wrongly assumes that after parsing an object, we're not in a leaf object context anymore. While it is usually the case that there are no sub-objects within an object that's mapped as subobjects: false, there's one exception to the rule: when a field is mapped as flattened. While the DocumentParser does successfully parse objects that are mapped as flattened within a subobjects: false context, it sets context.path().setWithinLeafObject(false) after parsing a flattened object so that subsequent fields get their dots expanded.

@felixbarny felixbarny added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types labels Feb 12, 2024
@elasticsearchmachine elasticsearchmachine added Team:Search Meta label for search team external-contributor Pull request authored by a developer outside the Elasticsearch team v8.13.0 labels Feb 12, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @felixbarny, I've created a changelog YAML for you.

Copy link
Copy Markdown
Contributor

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'm afraid that flattened isn't the only exception, there's also rank features and percolator that are hit by the same bug perhaps. Thanks for finding and fixing. Does this fix a related issue? I did not see its link in the description.

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💚 Backport successful

Status Branch Result
8.13

@felixbarny
Copy link
Copy Markdown
Member Author

Does this fix a related issue? I did not see its link in the description.

I don't think there's an issue that has been filed for this. I've detected the issue myself when playing around with subobjects: false and flattened fields in the context of #104455. It was a very strange bug to debug as it depends on ordering and because when ingest pipelines are executed, the ordering of fields change because fields are put into a hash map. Therefore, the ordering also depends on the name you choose for field names. It took me longer than I'd like to admit to realize that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug external-contributor Pull request authored by a developer outside the Elasticsearch team :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v8.13.0 v8.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants