assuming i have the mapping:
{ "my_doctype" :
{
"_timestamp" : { "enabled" : True },
"properties":
{
"my_set": { "type": "string", "index":"analyzed" },
}
}
}
I am trying to use the update API to add an item to a list, making sure it does not exist yet (and not caring about the order in the list):
curl -XPOST 'localhost:9200/test/my_doctype/1/_update' -d '{
"script" : "ctx._source.my_set = list(set(ctx._source.my_set).add('new_item'))",
"lang" : "python"
}'
This results in :
{
"error" : "ElasticSearchIllegalArgumentException[failed to execute script]; nested: ElasticSearchIllegalArgumentException[script_lang not supported [python]]; ",
"status" : 400
}
my ES version is 0.20.4 and i tried using both elasticsearch-lang-python/1.1.0 and elasticsearch-lang-python/1.2.0 with the same outcome.
Also, is there a way to do what I asked without the python , using mvel instead?