0

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.

skasar
  • 11
  • 4
  • See doc https://grafana.com/grafana/plugins/grafana-opensearch-datasource/ that's not possible because "Query will use current dashboard time range as time range for query." – Jan Garaj Sep 14 '22 at 20:53

1 Answers1

0

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?

Stefan
  • 7
  • 3