Skip to content

_source filtering shouldn't remove objects unless explicitly excluded #4715

@bleskes

Description

@bleskes

We currently support _source filtering both on indexing time and read time using include/exclude terms. Currently, the logic is aggressively removing objects where all the fields has been removed, trying to make things as compact as possible. For example, consider the following document:

{
    obj: { f: 1 }
}

using exclude=['obj.f'], will return {} because the obj now becomes empty. However, the same exclude=['obj.f'] will return { obj : { d : 1 } if the original document is:

{
    obj: { f: 1, d :1 }
}

This causes client code interested in obj.d to need to always have to test whether obj is there before checking if obj.d exists. This can be cumbersome but also is not expected as the obj.f was excluded but not obj

This should change and only remove objects if they explicitly match an exclude (like exclude=['obj']), maintaining the object structure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions