This works:
def val = doc['Tunings.Data'].value;
def str = val.replace('[', '').replace(']', '').replace('\"', '');
return str == '3';
So now I understand that Elasticsearch is doing no interpretation of double quotes as indicating strings. Is there any way to get Elasticsearch (within or without Painless) to understand a string field formatted as follows as an array of strings? Like:
["0"],["1"],["2"]