Skip to content

Change time filter quick ranges default settings #100344

@flash1293

Description

@flash1293

If the time range is large enough to hit multiple shards, we should try to keep the start of the range stable so the shards containing data can leverage their request cache.

Right now a lot of the default quick ranges look like this:

  {
    "from": "now-30m",
    "to": "now",
    "display": "Last 30 minutes"
  }

This compiles to a filter like this (note the uneven gte):

"range": {
            "timestamp": {
              "gte": "2021-05-19T13:34:29.128Z",
              "lte": "2021-05-19T14:04:29.128Z",
              "format": "strict_date_optional_time"
            }
          }

Refreshing after a few seconds leads to a filter like this:

"range": {
            "timestamp": {
              "gte": "2021-05-19T13:34:33.764Z",
              "lte": "2021-05-19T14:04:33.764Z",
              "format": "strict_date_optional_time"
            }
          }

With a lower bound rounded to the minute it would look like this:

"range": {
            "timestamp": {
              "gte": "2021-05-19T13:34:00.000Z",
              "lte": "2021-05-19T14:04:33.764Z",
              "format": "strict_date_optional_time"
            }
          }

These defaults would play better with caches without changing the user experience in a meaningful way:

[
  {
    "from": "now/d",
    "to": "now/d",
    "display": "Today"
  },
  {
    "from": "now/w",
    "to": "now/w",
    "display": "This week"
  },
  {
    "from": "now-15m/m",
    "to": "now",
    "display": "Last 15 minutes"
  },
  {
    "from": "now-30m/m",
    "to": "now",
    "display": "Last 30 minutes"
  },
  {
    "from": "now-1h/m",
    "to": "now",
    "display": "Last 1 hour"
  },
  {
    "from": "now-24h/h",
    "to": "now",
    "display": "Last 24 hours"
  },
  {
    "from": "now-7d/d",
    "to": "now",
    "display": "Last 7 days"
  },
  {
    "from": "now-30d/d",
    "to": "now",
    "display": "Last 30 days"
  },
  {
    "from": "now-90d/d",
    "to": "now",
    "display": "Last 90 days"
  },
  {
    "from": "now-1y/d",
    "to": "now",
    "display": "Last 1 year"
  }
]

Not sure who owns this (I'm guessing @elastic/kibana-app-services ?)

cc @nik9000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions