How to exclude numeric value from a pie chart?

I'm trying to set up a piechart displaying data from a number-type field. In advanced option there is an "Exclude" field which I want to use, but I can't find a way to get it to work. Whatever I type in (I want to exclude value 0, so I tried 0, [0], "0", ["0"] etc.) I get the error:

Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"aggregation_execution_exception","reason":"Aggregation [2] cannot support regular expression style include/exclude settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses used to filter numeric fields"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"prod-oddjob-persistence","node":"0C8MFw1eSDecV96BRXi49A","reason":{"type":"aggregation_execution_exception","reason":"Aggregation [2] cannot support regular expression style include/exclude settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses used to filter numeric fields"}}],"caused_by":{"type":"aggregation_execution_exception","reason":"Aggregation [2] cannot support regular expression style include/exclude settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses used to filter numeric fields"}},"status":500}

It seems like it should be doable (Use an array of numeric values for include/exclude clauses used to filter numeric fields), but it does not seem to accept my input. Is this a bug or a not implemented feature?

I'm using Kibana 5.3.0.

In the aggregation, exclude is a way to filter values in the terms agg. More correctly, it's a way to filter buckets/aggregations, but not their metric.

The problem is, 0 isn't an aggregation, it's a metric. That is, it's a count, or sum, or average, etc. Kibana doesn't allow you to filter metrics, so what you're trying to do isn't possible. You could do what you want using the bucket_selector aggregation, but Kibana doesn't have support for that.

Thanks for the explanation.

For future visitors - the workaround for my use case was having a pie chart use a predefined search in which I explicitly exclude 0 value.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.