Use script field based on field of type string

I have the following document:

 {
   "parts": ["a", "b", "c"]
 }

I want to use the script field feature to add another field to the result, so the final result will look like this:

Not empty value:

_source: {
   "parts":["a", "b", "c"]
},
"fields": {
   "isEmpty":  false
}

Empty value:

this:

_source: {
   "parts":[] // or null
},
"fields": {
   "isEmpty":  true
}

I tried to do with with the following query:

{
   "query": {
       "match_all": {}
   },
   "script_fields" : {
        "isEmpty" : {
            "script" : {
                "lang": "expression",
                "inline": "doc['parts'].empty"
            }
        }
    }
}

But I get the following exception:

"reason": "Only the member variable [value] or member methods may be accessed on a field when not accessing the field directly"

What am I doing wrong?

Anyone? :frowning: