Visualization empty for scripted field

I have created a scripted field to get dayOfWeek from date field as below:
if (doc['result.opened_at'].size() != 0)
{
if (!doc['result.opened_at'].empty) {
doc['result.opened_at'].value.dayOfWeek
}
}
I could see the field created and populates the value in discover.

But in Kibana could not see the bar chart or any of the chart for the same scripted field.


Not sure what I am missing here...

Hi @ReenaN,

Couple questions for you:

  1. What version of the stack are you running?
  2. Could you please provide an example of the type of documents you are querying? Maybe just the _source for a few of them would be helpful.
  3. And just to make sure I understood your question: you are seeing the field listed in discover with no issues, but when you try to do a terms aggregation against the field for the same timerange you see no results?

Hi @lukeelmers,
I have ElasticSearch on version 7.5.0. You got it right, in discover I see the field generated but in kibana term aggregate do not provide any result, shows blank graph

.
I have created new field now as weekday_open with the same definition.
Attached is the source of one of the document.