Created
September 27, 2012 09:29
-
-
Save smetj/3793111 to your computer and use it in GitHub Desktop.
ElasticSearch update script having problems with fields starting with @ sign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Version: 0.19.9 | |
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 | |
} | |
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"}}' | |
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} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment