Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Fix for NPE during TermsAggregation instantiation #210

Merged
merged 1 commit into from
Jun 23, 2015

Conversation

VlasShatokhin
Copy link
Contributor

We could get NPE during TermsAggregation instantiation since following fields may not be presented in aggregation response:

  • doc_count_error_upper_bound
  • sum_other_doc_count

@kramer
Copy link
Member

kramer commented Jun 14, 2015

How would those fields not be present? They are not optional or modifiable and always returned by ES as far as I can see.

@VlasShatokhin
Copy link
Contributor Author

We currently use ES 1.3.4, which returns TermsAggregations result without both of those fields. It could be a bug for that old version.

@kramer
Copy link
Member

kramer commented Jun 18, 2015

Fair enough. Instead of null check using JsonObject.has()would be nicer. Also we will need the same for other aggregation classes as well, would you be up for it?

@VlasShatokhin
Copy link
Contributor Author

Sure. I'll update this PR tomorrow

@VlasShatokhin
Copy link
Contributor Author

I didn't found any other usages of SUM_OTHER_DOC_COUNT and DOC_COUNT_ERROR_UPPER_BOUND fields, so looks we won't have such issue with other aggregation classes.

kramer pushed a commit that referenced this pull request Jun 23, 2015
bugfix: NPE in TermsAggregation instantiation with older ES server versions
@kramer kramer merged commit de4f17a into searchbox-io:master Jun 23, 2015
@kramer
Copy link
Member

kramer commented Jun 23, 2015

Thanks for your contribution @VlasShatokhin!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants