Unexpected token [':'] was expecting one of [{<EOF>, ';'}]

Hello, in my mappings I have a field with the character ':' in it, specifically

  "meta_og:type" : {
    "type" : "text",
    "fields" : {
      "keyword" : {
        "type" : "keyword",
        "ignore_above" : 256
      }
    }
  },

I want to add a value to this field in a document with the curl

curl -X POST "localhost:9200/nutchindex2/doc/27130d1a085cf91f0ac9bf7c3a75797a/_update?pretty" -H 'Content-Type: application/json' -d'                                                      
{
    "script" : "ctx._source.meta_og:type = \"article\""
}
'

But I get the following error

{
  "error" : {
    "root_cause" : [
      {
        "type" : "remote_transport_exception",
        "reason" : "[WgJFBhd][10.164.0.4:9300][indices:data/write/update[s]]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "failed to execute script",
    "caused_by" : {
      "type" : "script_exception",
      "reason" : "compile error",
      "script_stack" : [
        "ctx._source.meta_og:type = \"article\"",
        "                   ^---- HERE"
      ],
      "script" : "ctx._source.meta_og:type = \"article\"",
      "lang" : "painless",
      "caused_by" : {
        "type" : "illegal_argument_exception",
        "reason" : "unexpected token [':'] was expecting one of [{<EOF>, ';'}]."
      }
    }
  },
  "status" : 400
}

If I do the exact same append, but to the field "type" instead of "meta_of:type", it works perfectly. (i have the field "type" mapped aswell).

So is there a way to break the "illeagal" character, or something like that. I tried using

og_meta\:type

,but that didnt work either.

EDIT: I am using Elastic 5.4

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