How to dislink time picker and X-axis of Lens

I have a trouble with when I want to select documents from an index pattern by their Time field using time picker and visualize a date histogram on another datetime field.

  1. I created an index and an index pattern with Time field on CREATE_DATE.
PUT test_two_date_fields
{
  "mappings": {
    "properties": {
      "CREATE_DATE":{"type":"date"},
      "UPDATE_DATE":{"type":"date"},
      "TYPE": {"type": "keyword"}
    }
  }
}

POST test_two_date_fields/_doc
{
  "CREATE_DATE": "2022-05-01",
  "UPDATE_DATE": "2022-06-01",
  "TYPE": "A"
}

POST test_two_date_fields/_doc
{
  "CREATE_DATE": "2022-05-02",
  "UPDATE_DATE": "2022-05-02",
  "TYPE": "A"
}

POST test_two_date_fields/_doc
{
  "CREATE_DATE": "2022-05-03",
  "UPDATE_DATE": "2022-05-04",
  "TYPE": "B"
}

  1. First, when using Discover, of course time picker filter documents by the Time field (here: CREATE_DATE) of the index pattern.

  2. Using Lens, if I want to visualize a date histogram for UPDATE_DATE with filtering by the Time field ( CREATE_DATE) using time_picker, I get the time picker applied not on Time field but on the plot's X-axis: UPDATE_DATE.

  3. With "Aggregation based", even if a Date Histogram of a datetime field is set on X-axis buckets, the time-picker filters the documents by the Time field of the index pattern. The range of the x-axis is automatically fit to the min/max of the field.

The behavior between 2. and 3. is not consistent and I feel it a little strange that the time picker works for filtering on X-axis just when the X-axis is a datetime field. The group of documents will be different between multiple visualizations on a single dashboard. Is there any option to dislink time picker and X-axis of Lens?

Hi @Tomo_M

this feature has been added in Lens since 8.2.0: [Lens] Allow detaching from global time range by flash1293 · Pull Request #125563 · elastic/kibana · GitHub

Thank you @Marco_Liberati !
That feature is just I needed.
I'm planning to update. Thanks :grinning:

2 Likes

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