Updates and executing scripts on fields containing @

Hi list,

My goal is to update an array which name starts with an @ sign.
For this I use the _update API by executing an mvel script. It seems to
work fine on elements which have a regular name.

I'm running version 0.19.9

See following output:

curl -XGET 'http://xxx:9200/_cluster/health?pretty=true'
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 1,
"active_primary_shards" : 85,
"active_shards" : 85,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 85
}

This works:
curl -XPUT xxx:9200/test/test/1 -d '{"counter" : 1, "tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/1/_update' -d '{"script" : "ctx._source.tags += tag","params": {"tag":"fubar2"}}'

This does not work:
curl -XPUT xxx:9200/test/test/2 -d '{"counter" : 1, "@tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/2/_update' -d '{"script" : "ctx._source.@tags += tag","params": {"tag":"fubar2"}}'

{"error":"ElasticSearchIllegalArgumentException[failed to execute script]; nested: ArrayIndexOutOfBoundsException[0]; ","status":400}

--

Submitted as bugreport:

--

Hi Jelle,

I'm having the same issue. Were you able to find a solution or workaround
for this?

Thanks,

Clive

On Thursday, September 27, 2012 5:45:46 AM UTC-4, Jelle Smet wrote:

Hi list,

My goal is to update an array which name starts with an @ sign.
For this I use the _update API by executing an mvel script. It seems to
work fine on elements which have a regular name.

I'm running version 0.19.9

See following output:

curl -XGET 'http://xxx:9200/_cluster/health?pretty=true'
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 1,
"active_primary_shards" : 85,
"active_shards" : 85,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 85
}

This works:
curl -XPUT xxx:9200/test/test/1 -d '{"counter" : 1, "tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/1/_update' -d '{"script" : "ctx._source.tags += tag","params": {"tag":"fubar2"}}'

This does not work:
curl -XPUT xxx:9200/test/test/2 -d '{"counter" : 1, "@tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/2/_update' -d '{"script" : "ctx._source.@tags += tag","params": {"tag":"fubar2"}}'

{"error":"ElasticSearchIllegalArgumentException[failed to execute script]; nested: ArrayIndexOutOfBoundsException[0]; ","status":400}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

See

On Friday, April 5, 2013 1:58:05 PM UTC-4, clive.w...@chloeandisabel.com
wrote:

Hi Jelle,

I'm having the same issue. Were you able to find a solution or workaround
for this?

Thanks,

Clive

On Thursday, September 27, 2012 5:45:46 AM UTC-4, Jelle Smet wrote:

Hi list,

My goal is to update an array which name starts with an @ sign.
For this I use the _update API by executing an mvel script. It seems to
work fine on elements which have a regular name.

I'm running version 0.19.9

See following output:

curl -XGET 'http://xxx:9200/_cluster/health?pretty=true'
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 1,
"active_primary_shards" : 85,
"active_shards" : 85,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 85
}

This works:
curl -XPUT xxx:9200/test/test/1 -d '{"counter" : 1, "tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/1/_update' -d '{"script" : "ctx._source.tags += tag","params": {"tag":"fubar2"}}'

This does not work:
curl -XPUT xxx:9200/test/test/2 -d '{"counter" : 1, "@tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/2/_update' -d '{"script" : "ctx._source.@tags += tag","params": {"tag":"fubar2"}}'

{"error":"ElasticSearchIllegalArgumentException[failed to execute script]; nested: ArrayIndexOutOfBoundsException[0]; ","status":400}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I'm very sorry to hijack an unrelated thread, but does anyone know why
google groups just deleted my new post on my SearchParseException? It
certainly didn't have anything objectionable or spammy in it.

-Brian

On Friday, April 5, 2013 12:18:30 PM UTC-6, Igor Motov wrote:

See
API Update Tags Problem · Issue #2852 · elastic/elasticsearch · GitHub

On Friday, April 5, 2013 1:58:05 PM UTC-4, clive.w...@chloeandisabel.comwrote:

Hi Jelle,

I'm having the same issue. Were you able to find a solution or
workaround for this?

Thanks,

Clive

On Thursday, September 27, 2012 5:45:46 AM UTC-4, Jelle Smet wrote:

Hi list,

My goal is to update an array which name starts with an @ sign.
For this I use the _update API by executing an mvel script. It seems to
work fine on elements which have a regular name.

I'm running version 0.19.9

See following output:

curl -XGET 'http://xxx:9200/_cluster/health?pretty=true'
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 1,
"active_primary_shards" : 85,
"active_shards" : 85,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 85
}

This works:
curl -XPUT xxx:9200/test/test/1 -d '{"counter" : 1, "tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/1/_update' -d '{"script" : "ctx._source.tags += tag","params": {"tag":"fubar2"}}'

This does not work:
curl -XPUT xxx:9200/test/test/2 -d '{"counter" : 1, "@tags" : ["fubar1"]}'
curl -XPOST 'xxx:9200/test/test/2/_update' -d '{"script" : "ctx._source.@tags += tag","params": {"tag":"fubar2"}}'

{"error":"ElasticSearchIllegalArgumentException[failed to execute script]; nested: ArrayIndexOutOfBoundsException[0]; ","status":400}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.