Can we use scripted field in kibana in term aggregation?

I created scripted field in kibana named service_exception.keyword. Now I am trying to create a watcher, which aims to catch the most occurrences exception service. But it not work. I tried replace it by another field and it work.

Is scripted field problem? If it is, Is it have any solution to deal with that? Thanks.


You're right, the Scripted Fields are the problem.
It's best to think of Scripted Fields as a way of computing on the data when it is loaded by Kibana, and so it is only available in Kibana itself.
Watcher, on the other hand, runs inside of Elasticsearch and so it can only trigger based on the data that's available there.

The solution for your use case is, I believe, using some kind of an Inline Script which are evaluated inside of Elasticsearch and so are accessible to Watcher.

You can read all about scripting here:

And further here:

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