Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bleskes opened this issue Jan 14, 2014 · 0 comments
Closed

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

bleskes opened this issue Jan 14, 2014 · 0 comments

Comments

@bleskes
Copy link
Contributor

bleskes commented Jan 14, 2014

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.

bleskes pushed a commit to bleskes/elasticsearch that referenced this issue Jan 14, 2014
When excluding '*.f1' from `{ "obj": { "f1": 1, "f2": 2 } }` XContentMapValues.filter returns `{ "obj": { "f2": 2}}`. When run on `{ "obj": { "f1" : 1 }}` we should return `{ "obj": { }}` to maintain object structure. People currently need to always check whether `obj` is there or not.

Closes elastic#4715
Closes elastic#4047
Related to elastic#4491
brusic pushed a commit to brusic/elasticsearch that referenced this issue Jan 19, 2014
When excluding '*.f1' from `{ "obj": { "f1": 1, "f2": 2 } }` XContentMapValues.filter returns `{ "obj": { "f2": 2}}`. When run on `{ "obj": { "f1" : 1 }}` we should return `{ "obj": { }}` to maintain object structure. People currently need to always check whether `obj` is there or not.

Closes elastic#4715
Closes elastic#4047
Related to elastic#4491
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant