I am tasked with updating the datetime field to keep log records within a week of the current date. The data set contains records from a 1 month period and I need to increment each record by a set number of days so simply replacing the field with a specific date is not ideal. Is there a way to use update by query (example below is what I used to replace a username across all documents) to increment the datetime field?
This is hard in Painless because the date field will be returned from the ctx._source context as a string. You'll need to parse it into a LocalDateTime type, which is messy. Once you have that, you can call the plusDays method to add any number of days you like, then probably call toString to get the string representation back and set it in the context.
This might give you enough to go on. I've already worn myself out looking through Painless and Java docs!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.