The current solution to handle situations where no data are present is to check the hits parameter on the elasticsearch response. If hits === 0, then an error is thrown and the visualize directive displays a no results found message in place of the chart.
While this deals with situations where there are no hits, it doesn't fully address the issue. There are other ways in which an Elasticsearch response with no data can be sent to the visualization library. I am not completely sure of all the ways that this can happen, but it would be great to have a list of all the ways in which this particular situation can manifest. I will attempt to start one below.
@rashidkpc @spenceralger @jthomassie @w33ble @lukasolson @simianhacker feel free to add to the list or add to the discussion ways in which to handle these situations.
- A user does a search where empty buckets are returned. In these instances, the hits count can be greater than
zero, but the buckets are empty. In this situation, the visualization library renders an empty chart or throws an error if the chart rendering depends on data stored in the data object.
- Elasticsearch returns a response where all the values are zero. In which case, a chart is rendered with nothing in it.
In my opinion, case 2, isn't actually a bug. A visualization library should render 0 values. It is a valid response. Somethings have zero values and we even purposely introduce zero values with our zero_injection function. I think it would be very difficult to determine when and when not to display zero values. I think the real issue is to distinguish between values of 0 and elasticsearch responses that return nothing.
Zero is equal to nothing, but nothing isn't always equal to zero
Thoughts?
The current solution to handle situations where no data are present is to check the
hitsparameter on the elasticsearch response. Ifhits === 0, then an error is thrown and thevisualizedirective displays ano results foundmessage in place of the chart.While this deals with situations where there are no hits, it doesn't fully address the issue. There are other ways in which an Elasticsearch response with no data can be sent to the visualization library. I am not completely sure of all the ways that this can happen, but it would be great to have a list of all the ways in which this particular situation can manifest. I will attempt to start one below.
@rashidkpc @spenceralger @jthomassie @w33ble @lukasolson @simianhacker feel free to add to the list or add to the discussion ways in which to handle these situations.
zero, but the buckets are empty. In this situation, the visualization library renders an empty chart or throws an error if the chart rendering depends on data stored in the data object.In my opinion, case 2, isn't actually a bug. A visualization library should render 0 values. It is a valid response. Somethings have zero values and we even purposely introduce zero values with our
zero_injectionfunction. I think it would be very difficult to determine when and when not to display zero values. I think the real issue is to distinguish between values of 0 and elasticsearch responses that return nothing.Zero is equal to nothing, but nothing isn't always equal to zero
Thoughts?