Create new field "Year" from a complete date

Hi everybody !

I have a probleme : I have a field "date". I want to select juste the year, and create a vizualisation "controls" type (Add dropdown menus and range sliders to your dashboard) with the new field.

For this i create a scripted field :


doc['participations.date'].value.year

It works, but when i insert the new field in vizualisation type "controls" I have an error : "Unable to fetch terms, error : Eserror".

Do you have an idea what is wrong please ?

Thank you very much for your help !

Hi @Raptoresse Welcome to the community.

I suspect the problem is, is that scripted fields are not available for every control / visualization etc.

There is a new field type Runtime Fields (similar to scripted but much better) that are available like any other field

Perhaps take a look

Thanks Stephenb !

Your proposal run on the latest version of kibana, but I'm on 7.11 and I can't change for the moment :confused:

Why that scripted field is not available for control ? Because it's a date type ? I tried to change for a string and take juste the four latest caracteres but it also don't works...

Yes sorry as I read closer the drop down control needs a type keyword not date or text

In the script

"type": "keyword"

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