Distinct values of one field based on date range

Hello community :wave: ,
I struggling with Elasticsearch query and sadly I cannot get correct response. :unamused:
What I want is get unique/disctinct values for specific field in last X minutes.
I have something like this:

    GET my-index*/_search
    {
      "size": 0,
      "query": {
        "range": {
          "@timestamp": {
            "gt": "now-15m"
          }
        }
      },
      "aggs": {
        "Data": {
          "terms": {
            "field": "name"
          }
        }
      }
    }

I got this response:

    {
      "took" : 50,
      "timed_out" : false,
      "_shards" : {
        "total" : 128,
        "successful" : 128,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : {
          "value" : 10000,
          "relation" : "gte"
        },
        "max_score" : null,
        "hits" : [ ]
      },
      "aggregations" : {
        "Data" : {
          "doc_count_error_upper_bound" : 0,
          "sum_other_doc_count" : 0,
          "buckets" : [ ]
        }
      }
    }

As you can see, there is no related output. What is wrong with my query?
Thank you.

BUMB!
Nobody? :face_with_raised_eyebrow:

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