Scripted field

Hi everyone

I created a scripted field to extract the hour of the week from @timestamp

doc['@timestamp'].value.hour

and its working fine.

But when i try to extract the day of week using this query in dev tools

GET filebeat-7.8*/_search
{
"script_fields": {
"birth_year": {
"script": {
"source": "doc['@timestamp'].value.dayOfWeek"
}
}
}
}

It's working fine as well but this scripted field gives me shard failed error when i use discover for filebeat-7.8*.

Can anyone share how to get the day of week using scripted field? i will use thi scripted in visualizations

Hi

Could you provide the shard error you're receiving in Discover?

Many thx!
Best,
Matthias

Hi.

turns out that the scripted field function dayofweek is depreciated in version 7.8.
Also the mapping type for IP in version 7.7 and 7.8 is different so we remove the 7.7 indices and reindex using 7.8. Until then it works fine. The mapping conflict caused the error.

Thank you for sharing! so it's solved, right?

yes i believe so, thanks man!

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