Date, Scripted Fields

Hello All,

I'm getting data as below from my application


I would like the data of the field value as Date instead of a string when the name data is 'DateTime'. I tried using the scripted field for this, but not working..

if doc[''].value == 'name' then
retrun new Date(Long.parseLong(doc['extraParams.value'].value)

Any help or guidance would be appreciated.

I have made few changes to mapping '"store": true', and recreated the index. Now, the script works without an error, but not seeing value as expected.

I verified the source documents, and I see a field with date.

if (doc[''].value == "DateTime") {
return new Date(Long.parseLong(doc["extraParams.value.keyword"].value));

What does it display with the current scripted field? the number 0001519156380000 as a string?

yeah, string.

I got it working. Thanks for responding.

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