How do i extract all the distinct values from a field in opensearch? I am trying get list of all the distinct names using following:
{"find": "terms", "field": "first_name"}
I also want to utilize the same syntax in grafana to create a variable.
How do i extract all the distinct values from a field in opensearch? I am trying get list of all the distinct names using following:
{"find": "terms", "field": "first_name"}
I also want to utilize the same syntax in grafana to create a variable.
To get all distinct values from a field in opensearch you can make use of bucket aggregations as described in their documentation: https://opensearch.org/docs/latest/aggregations/bucket-agg/#terms
Also have a look at this post: Elasticsearch- get all values for a given field?