Scripted field on Aggregated value

Scripted fields can work on a field or set of fields in the document. I would like to create scripted field on aggregated value.

Say, I have terms aggregation of fieldA with count metric.
I would like to create another field based on the value of count, which says:

if count <= value, scripted_field = 1,
if value1<= count <=value2, scripted_field=2,
....
how can I achieve this in Kibana?

Also, finally have a data table like this: Is it possible?

 fieldA            Count             scripted_field
  .....            .....                 ......
  .....            .....                 ......

Hi Krishna,

Scripted fields work only on values within each individual doc. So if a doc had 3 numeric fields you could use a scripted field to add them together, or average them, or find the min, max, etc. But not across all docs or a set of docs.

But you can also use some scripting within Visualizations in the Advanced JSON field;

I don't know of very many exampels of using it, but here's one;

Regards,
Lee

Thanks for the response, Lee

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