# Batch update documents with new fields

**URL:** <https://discuss.elastic.co/t/batch-update-documents-with-new-fields/10415>\
**Category:** Elasticsearch\
**Created:** [January 18, 2013, 9:06pm UTC](https://discuss.elastic.co/t/batch-update-documents-with-new-fields/10415 "2013-01-18T21:06:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kubes](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kubes](https://discuss.elastic.co/u/Kubes)\
**Post date:** [January 18, 2013, 9:06pm UTC](https://discuss.elastic.co/t/batch-update-documents-with-new-fields/10415/1 "2013-01-18T21:06:28Z")

</div>

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,  
so).
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  
#2.

Is there a better approach to this?

Thanks

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:55am UTC](https://discuss.elastic.co/t/batch-update-documents-with-new-fields/10415/2 "2017-07-06T02:55:39Z")

</div>


