Metric or legacy lens does not apply dashboard context filter

Hello,

I'm creating a dashboard in Kibana to visualize some metrics, and I'm encountering an issue with the date selector.

The date selector works perfectly for most visualizations, but when I use either the "legacy" lens or the "Metric" lens, the context filter from the date selector does not seem to apply.

I’ve looked through the settings and documentation but haven’t found a way to make these lenses respect the date filter.

What I’ve tried:

  • Adjusting dashboard settings.
  • Verifying that the filter is applied correctly for other visualizations.

Has anyone else experienced this? Is there a way to ensure the context filter applies to these specific lenses?

Thanks,
j-nash

Hi @j-nash,

that sounds very strange.
Are you able to share either a recording of the problem or the configuration of the visualizations with some reproducible steps?

Thank you for responding!

I’ve put together a series of images to illustrate the issue:

In part 1, I have created my lens to count documents that have "job success".

However in part 2, when I set the time picker to very recently (~3 mins ago), it still shows the count for all the documents.

In part 3, you can see all documents were created days ago and should not be included in the count.

Let me know if further clarification or details would help!

From the screenshots it looks like the osprey-* dataView has not default time field defined, hence any search in that dataView would scan the entire dataset.

Could you check in the Stack management if the osprey-* dataView has the time field defined?

Thank you that fixed it. I thought I had checked it as the drop down in the settings had @timestamp selected, but not until I clicked the save button did it apply it.

Thank you for your help.