-
Notifications
You must be signed in to change notification settings - Fork 6
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
Dynamically determine bucket size for histograms #107
Conversation
@@ -14,6 +14,7 @@ | |||
from elasticsearch_dsl import HistogramFacet |
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.
I think this is fine as a patch for some of the data we currently have, however it won't address numbers much larger than 100, and won't take into account the distribution of the data.
api/data_explorer/__main__.py
Outdated
# is fixed, use AutoHistogramFacet instead. Will no longer need 2 | ||
# steps. | ||
# Step 1: Get max value | ||
response = Search( |
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.
Could you write a test for this?
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.
If it were easy to test, I would. But it's not easy, and this is throw-away code, so I'd rather not add a test...
# Elasticsearch won't do this for us | ||
# (https://github.com/elastic/elasticsearch/issues/9572). Make the | ||
# ranges easy to read (10-19,20-29 instead of 10-17,18-25). | ||
# Creating this facet is a two-step process. |
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.
Since this function is getting pretty long and has substeps and sub-documentation, split out to helper methods _get_max_value
and _get_bucket_size
?
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.
Done
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.
Thanks!
This is for NHS. Note that I don't want to put too much effort into this, because all this will go away after elastic/elasticsearch#31828 is fixed.