Error in Visualization with scripted field

Hi, i imported a csv file with a date column (Format example: '2019-05-01') and Kibana does not recognize it and read it like string.
I tried to transform it with a scripted field:

doc['Fecha'].value

I put date in the type and save successfully, but when i try to make a line chart, i got this error when a put in the X axis the new date created:

Error in visualization

Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"aggregation_execution_exception","reason":"Unsupported script value [2019-05-01], expected a number, date, or boolean"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"easy_aseos","node":"6qQvYLItTRqxT0zjGte05A","reason":{"type":"aggregation_execution_exception","reason":"Unsupported script value [2019-05-01], expected a number, date, or boolean"}}]},"status":500}

Can you share the mappings for the Fecha field? If it's a string and we want the scripted field to be a date we'll have to coerce it. Ideally the csv import is mapping the field as a date, but if not something like:

 new SimpleDateFormat('yyy-MMM-dd').parse(doc['Fecha'].value).getTime();

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