Skip to content

Prevent field API NPEs from token_count fields inside nested #69068

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

Merged
merged 8 commits into from
Feb 18, 2021

Conversation

cbuescher
Copy link
Member

Currently when a token_count field is defined inside a nested field, we get an
NPE because the underlying DocValueFetcher needs its formattedDocValues to be
loaded and the SourceLookup it sees needs to have a valid docId other than -1.
This change fixes those issues so the whole fields request doesn't error.
However this change doesn't solve the missing support for doc values lookup
under nested fields described in 68983. Fortunately token_count seems to be the only
mapping type currently affected.

Relates to #68983

@cbuescher cbuescher added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.12.0 labels Feb 16, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Feb 16, 2021
@elasticmachine
Copy link
Collaborator

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

Currently when a `token_count` field is defined inside a nested field, we get an
NPE because the underlying DocValueFetcher needs its formattedDocValues to be
loaded and the SourceLookup it sees needs to have a valid docId other than -1.
This change fixes those issues so the whole fields request doesn't error.
However this change doesn't solve the missing support for doc values lookup
under nested fields described in 68983. Fortunately `token_count` seems to be the only
mapping type currently affected.

Relates to elastic#68983
@cbuescher
Copy link
Member Author

@elasticsearchmachine run elasticsearch-ci/2

@DaveCTurner
Copy link
Contributor

Sorry @cbuescher for the failure, it's a rare but pervasive bug and a fix is incoming in #69102.

@elasticmachine please run elasticsearch-ci/2

@cbuescher
Copy link
Member Author

@elasticmachine update branch

@DaveCTurner
Copy link
Contributor

Ugh you're being really unlucky with that bug. The fix is now merged.

@cbuescher
Copy link
Member Author

@jtibshirani thanks for the review, I pushed the changes you suggested

@cbuescher
Copy link
Member Author

@elasticmachine update branch

@cbuescher
Copy link
Member Author

@elasticmachine run elasticsearch-ci/1
@elasticmachine run elasticsearch-ci/default-distro
@elasticsearchmachine run elasticsearch-ci/packaging-sample-unix

@@ -28,6 +29,7 @@
// the name of the nested field without the full path, i.e. in foo.bar.baz it would be baz
private final String nestedFieldName;
private final String[] nestedPathParts;
private LeafReaderContext currentContext;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to track the context anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, leftover. I pushed an update

Christoph Büscher added 2 commits February 18, 2021 19:18
@cbuescher cbuescher merged commit e55e0f1 into elastic:master Feb 18, 2021
cbuescher pushed a commit that referenced this pull request Feb 19, 2021
Currently when a `token_count` field is defined inside a nested field, we get an
NPE because the underlying DocValueFetcher needs its formattedDocValues to be
loaded and the SourceLookup it sees needs to have a valid docId other than -1.
This change fixes those issues so the whole fields request doesn't error.
However this change doesn't solve the missing support for doc values lookup
under nested fields described in 68983. Fortunately `token_count` seems to be the only
mapping type currently affected.

Relates to #68983
cbuescher pushed a commit that referenced this pull request Feb 19, 2021
Currently when a `token_count` field is defined inside a nested field, we get an
NPE because the underlying DocValueFetcher needs its formattedDocValues to be
loaded and the SourceLookup it sees needs to have a valid docId other than -1.
This change fixes those issues so the whole fields request doesn't error.
However this change doesn't solve the missing support for doc values lookup
under nested fields described in 68983. Fortunately `token_count` seems to be the only
mapping type currently affected.

Relates to #68983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.12.0 v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants