Skip to content

Field fetcher performance issue with lots of nested fields #97461

Closed
@jimczi

Description

@jimczi

Elasticsearch Version

main

Installed Plugins

No response

Java Version

bundled

OS Version

Not relevant

Problem Description

Mappings that contain a lot of nested fields at multiple levels suffer from a very slow fields option in the _search request.
The FieldFetcher initialisation seems to create a lot of redundant FieldFetcher for every nested field paths.
The following gist reproduces the issue.
Retrieving a single empty doc without providing any field in the field option takes several seconds due to the initialisation of the nested field fetcher.
I believe that the performance bug was introduced in #67432.
I marked the issue as a performance bug since having lots of nested fields shouldn't make every query using the fields option slow.

Steps to Reproduce

See https://gist.github.com/jimczi/87fd6bb6a4428cccbabb986de917f234

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions