Hi
for using the update query i referred to
http://www.elasticsearch.org/guide/reference/api/update/
eg: And, we can delete the doc if the tags contain blue, or ignore (noop):
curl -XPOST 'localhost:9200/test/type1/1/_update' -d '{
"script" : "ctx._source.tags.contains(tag) ? ctx.op = "delete" : ctx.op
= "none"",
"params" : {
"tag" : "blue"
}
}'
I have modified the above query as follows:
curl -XPOST "http://10.118.192.145:9200/test/type1/1/_update" -d '{
"script" : "ctx._source.tags.contains(tag) ? ctx.op = "none" : ctx._source.tags += tag",
"params" : {
"tag" : "Orange"
}
}'
I want to check for a tag before adding to it. If the tag exists, do nothing else perform the update to add.
the above query creates a new version for the record but does not add the new tag.
How can i acheive this?
Thanks
Kuwar Sahani
--
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.