I found this solution : curl -XPOST localhost:9200/test/type1/1/_update -d ' { , "script" : "ctx._source.timestamp = ((ctx._source.timestamp).split(/-/)[0].toInteger()-1)+\"-\"+(ctx._source.timestamp).split(/-/)[1] +\"-\"+ctx._source.timestamp.split(/-/)[2] ", }'
On Wednesday, April 15, 2015 at 3:43:27 PM UTC+2, Amir Mofakhar wrote: > > I have below index : > > curl -XPUT localhost:9200/test/type1/1 -d '{ > "timestamp":"2015-04-15T12:00:00" > }' > > I can update it and change all timestamp to another date by below command : > > curl-XPOST localhost:9200/test/type1/1/_updat -d '{ > "script" :"ctx._source.timestamp = newts", > "params":{ > "newts":"2015-03-15T08:15:00" > } > }' > > But I need a way to update only some part of my time stamp for example I > want to : > > new timestamp = old timestamp + 3 days > > or > > new timestamp = old timestamp + 1 year > > > any suggestion? > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/94d90df0-4a49-49c7-9867-f572fb50bf86%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.