JSON input syntax

I am creating a data table visualization and I have a value that is either a 1 or 0, but in the column I was hoping to use json input so that if the value is a 1 it displays up and 0 displays down in the data table. Is that possible?

This is not working:
{
"script": "if (doc['status-check'].value = 0) {return down} else {return up}"
}

Hi Alison, you should be able to create a scripted field in your index pattern which can map the value to a string. It will be something like this:

if (doc['status-check'].value == 0) {
  return "down";
}
return "up";

Hope this helps,
CJ

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