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
Remove ability to set the value of meta fields inside _source
#11074
Conversation
if (!rootMapper.includeInObject() && rootMapper instanceof FieldMapper) { | ||
newFieldMappers.add((FieldMapper<?>) rootMapper); | ||
if (rootMapper instanceof FieldMapper) { | ||
newFieldMappers.add((FieldMapper)rootMapper); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/FieldMapper/FieldMapper<?>/ ?
This looks great! I think we should also add a note about this to the migration guide and have a simple test that checks that specifying these fields still works on old indices? |
5c9fe7a
to
ffd59e1
Compare
A few meta fields can currently be set within a document's source. However, the recommended way to set meta fields like this is through the api, and setting within the document can be a performance trap (e.g. needing to find _id in order to route the document). This change removes the ability to set meta fields within a document source for 2.0+ indexes. closes elastic#11051 closes elastic#11074
@jpountz I pushed a commit adding a migration note and tests. I actually found while testing that only |
A few meta fields can currently be set within a document's source. However, the recommended way to set meta fields like this is through the api, and setting within the document can be a performance trap (e.g. needing to find _id in order to route the document). This change removes the ability to set meta fields within a document source for 2.0+ indexes. closes elastic#11051 closes elastic#11074
ffd59e1
to
1df807d
Compare
1df807d
to
f766b26
Compare
LGTM |
Mappings: Remove ability to set meta fields inside documents
_source
We previously removed the ability to specify metadata fields inside documents in elastic#11074, but the backcompat left leniency that allowed this to still occur. This change locks down parsing so any metadata field found while parsing a document results in an exception. This only affects 2.0+ indexes; backcompat is maintained. closes elastic#13740
A few meta fields can currently be set within a document's source.
However, the recommended way to set meta fields like this is through
the api, and setting within the document can be a performance trap
(e.g. needing to find _id in order to route the document).
This change removes the ability to set meta fields within
a document source for 2.0+ indexes.
closes #11051