Aggregate after sort+size


(André Hänsel) #1

I can get the newest document before a certain timestamp with this query (hopefully with reasonable performance):

{
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "timestamp": {
              "lt": 1508010043
            }
          }
        }
      ]
    }
  },
  "sort": {
    "timestamp": "desc"
  },
  "size": 1
}

How can I run an aggregation on it?


(Ivan Brusic) #2

Sort and size have no affect on aggregations. Aggregations have their own
sort and size parameters, wherever applicable.


(system) #3

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