Vega scatterplot with scripted field

Hi,
I am trying to use a scripted field ("RGBstring") for my visualization but it doesn't work.
I can't find the reason.
this is the script:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "data": {
    "url": {
      "%context%": true,
      "index": "rgb-data*",
      "body": {
        "size": 10000,
        "_source": [
          "Xlocation",
          "Ylocation",
          "rgb.R",
          "rgb.G",
          "rgb.B",
          "group"
        ],
        "script_fields": {
          "RGBstring": {
            "script": {
              "lang": "painless",
              "source": "'rgb('+doc['rgb.R'].value+','+doc['rgb.G'].value+','+doc['rgb.B'].value+')'"
          }
        }
      }
    }
    },
    "format": {"property": "hits.hits"}
  },
  "mark": {"type": "square", "filled": true, "size": 1200},
  "encoding": {
    "x": {
      "field": "_source.Xlocation",
      "type": "quantitative",
      "axis": {"title": "X Location"}
    },
    "y": {
      "field": "_source.Ylocation",
      "type": "quantitative",
      "axis": {"title": "Y Location"}
    },
    "color": {"field": "fields.RGBstring", "scale": null},
    "tooltip": {"field": "_source.group"}
  }
}

and after running it I get:
Internal Server Error

Hi, is there any additional information about the error?
Can you post a screenshot of it?
Can you check also if the network request was successful and returned correctly the RGBstring field?
Does it happens if you reduce the size of they query to just a few items?

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