JSON Input for Unique Count Metrics

I want to modify the value of count in JSON Input like that


but it dosn't work,however,it work for other Metric Aggregation,sum, min and so on.
and I guess its not possible using Scripted Field for Unique Field.

It gives Internal Server Error

1 Like

There are examples of using a scripted value for the Cardinality function here: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html#_script_3

Specifically, you probably need to specify doc['_value'] as the field name in your script.

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