Selecting year from @timestamp for variable using elasticsearch

Dear all,
i have configured grafana to access elasticsearch 6.4.
i have created a graph, now i wan to have 4 list items which contain From Year, From Month, To Year and To Month.
i know i have to add variables to my page. i can add the whole field like below

it return the full date, i need to know the regular expression which i apply and it return distinct years from the field @timestamp.
then i need another regular expression to extract distinct months.
how i can do that?

Possibly found a bug. This should give you years in the “Regex” field:
/([a-z0-9.][a-z0-9.][a-z0-9.][a-z0-9.])/

but it doesn’t work. I think Grafana is storing timestamps internally as Epoch, so a regex against what you “see” as an ISO string, is actually being performed against an Epoch value (integer), so you will get the wrong result. At least that’s what I see in my initial testing of the same. I’ll try it a bit more and file a bug if that’s the case.

Note - that is an unnecessarily long, but still valid regex, I am using it for testing against a non-timestamp field as well.