How can I use scripted fileld result but as a filter aggregation not as terms in trend charts. And can I filter the result by comparing it with a fix value ??
The scripted fields are not intended to be used in too many places, so there are limitations for them. Filters do work, if you use KQL instead of Lucene, just with the standard syntax.
And the same stands for the filter aggregation, use KQL for the filters instead of Lucene. This choice is a relatively new feature, i think it 7.3+.
Thanks @Marius_Dragomir for the response.