Batch update documents with new fields

Looking for advice on how to add fields to existing documents.

I am looking parse http "user_agents" to to browser, type and os. This is
on already indexed documents.

  1. A facet search to return the top user agents.
  2. Parse the returned facet user agents into the new fields (brower, type,
  3. Query for each user agent form #1 and obtain a list of document IDs
  4. Use the update api to update each document and add thr new fields from

Is there a better approach to this?