"field cannot be used for filtering" kibana 5.2 error

I am currently using Elastic Search and Kibana 5.2 stack.

I created a simple kibana pie chart visualisation with count metric and a "string" field in an index.
I am getting the following error when I try to apply a filter on a string field by clicking on the Kibana pie chart.
"Filter bar: The "abc.keyword" field cannot be used for filtering"

Has anyone faced this issue before?

Appreciate any help with resolving the issue.

Regards,

This sounds like a bug, but I'd like to know more about how you're building the visualization and what the underlying data looks like.

Is the field analyzed? And are you using a non-analyzed field for the pie chart? Or did you enable terms aggs on analyzed fields?

Can you share a screenshot of the expanded Visualize sidebar so I can see how you've built the pie chart?

Here are the relevant screenshots

Field setup

Visualize Sidebar screenshot

Some more details:

  • The exact error message is 'Filter bar: The "foo.keyword" field can not be used for filtering."
  • It's only broken for one of our indexes, for other indexes in the same instance filtering works as expected.
  • It seems to be broken for all the fields in the index including strings, numbers etc.
  • However scripted fields always work. So you can work-around by wrapping a field as a scripted field and then filter on that, but this would be really tedious to set up across all the fields.
    Thanks

I wonder if the mapping cache is messed up, can you share your mappings for that field?