Updating an index with Scripted Metrics results


I'm performing a Scripted Metric aggregate around a hash value of Documents in order to generate a "Global Owner" result set. Basically, 'every person who owns this Document'.

Upon getting the result set, I then need to apply that result to each Document that has that hash value. I am currently performing an "update by query", searching for each individual hash value and updating the source through scripting with parameters. This is all done in PowerShell.

My question is, is there a better way to get those results saved, per hash value, than the way I'm doing it? I'm sending a REST request for each and every hash, which feels inefficient. I looked into the "bulk" API, but it appeared that I needed to know individual Document information, which is no good. I need to be able to update all Documents that share a hash value.

Apologies if any of this is well-known stuff. I'm new.
Thanks in advance for any help you folks can give!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.