Remove duplicate values across buckets

Hi All,

Is there a way to get unique values across all buckets?

{"user-id":"1", "user-name":"A", "user-age":"30", "update-date":"2018-01-01"}
{"user-id":"1", "user-name":"A", "user-age":"30", "update-date":"2018-02-01"}
{"user-id":"2", "user-name":"B", "user-age":"30", "update-date":"2018-01-01"}
{"user-id":"2", "user-name":"B", "user-age":"30", "update-date":"2018-02-01"}

The result I would like to get is two buckets based on 'user-name' and 'user-age' with the following records

{"user-id":"1", "user-name":"A", "user-age":"30", "update-date":"2018-02-01"}
{"user-id":"2", "user-name":"B", "user-age":"30", "update-date":"2018-02-01"}

Is it possible?

Thanks

use aggregation with scripted_metric..,

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html

Thank you

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