Remove duplicate values across buckets


(Monte_A) #1

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


(Ramkumar Pillai) #2

use aggregation with scripted_metric..,

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


(Monte_A) #3

Thank you


(system) #4

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