quickwit-oss/quickwit

partial request cache still not working when deriving metrics from documents

Closed this issue · 0 comments

when using quickwit to derive metrics, you end up with queries looking like this (emitted by grafana datasource):

{
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "timestamp",
        "fixed_interval": "1m",
        "min_doc_count": 0,
        "extended_bounds": {  // these dates prevent caching
          "min": 1672570377874,
          "max": 1672644841715
        }
      }
    }
  },
  "query": {
    "bool": {
      "filter": {
        "range": {
          "timestamp": { // these dates are correctly handled
            "gte": "2023-01-01T10:52:57.874Z",
            "lte": "2023-01-02T07:34:01.715Z"
          }
        }
      }
    }
  },
  "size": 0
}

sadly the extended_bounds changes at each query, which we don't handle, and causes the partial request cache to never hit on this kind of aggregation. An improvement could be to remove extended bounds in leaf_search_single_split so that the cache can hit, and verify we properly fill with zeroes when merging results from multiple leafs