Hi,
Using elasticsearch-7.5.2 with NEST client I'm trying to iterate through all documents in an update_by_query request and set different values to the same field (called wcf) in each doc.
My code looks like this:
var task = ElasticClient.UpdateByQuery<LogLine>(u => u.Index("test")
.Query(q => q
.MatchAll()
)
.Script(d => d
.Source("for (int i = 0; i < 7; i++) {ctx._source.wcf=i;}").Lang("painless")));
This code just updates all documents 7 times and I end up with all documents having the same value for the 'wcf' field while what I am actually looking for is to have the first document's 'wcf' field with value '0', the second with value '1' etc'.
Hope someone could assist me with this.
Thanks in advance!