# Add field to all documents of an index

**URL:** https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572
**Category:** Elasticsearch
**Created:** [September 2, 2014, 1:31pm UTC](https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572 "2014-09-02T13:31:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)
#### Post date: [September 2, 2014, 1:31pm UTC](https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572/1 "2014-09-02T13:31:54Z")

</div>

Hi I need to add a new field (with a default) to all documents already  
indexed.

I guess bulk update will do it?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [September 2, 2014, 5:15pm UTC](https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572/2 "2014-09-02T17:15:55Z")

</div>

Hello John ,

Update by query plugin would be a good choice -

> **[GitHub - yakaz/elasticsearch-action-updatebyquery: ElasticSearch Update By...](https://github.com/yakaz/elasticsearch-action-updatebyquery/)**
>
> ElasticSearch Update By Query action plugin. Contribute to yakaz/elasticsearch-action-updatebyquery development by creating an account on GitHub.

Just set a match\_all query.

Bulk API with updates to all the documents should also work.

Thanks  
Vineeth

On Tue, Sep 2, 2014 at 7:01 PM, John Smith [java.dev.mtl@gmail.com](mailto:java.dev.mtl@gmail.com) wrote:

> Hi I need to add a new field (with a default) to all documents already  
> indexed.
> 
> I guess bulk update will do it?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)
#### Post date: [September 2, 2014, 7:17pm UTC](https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572/3 "2014-09-02T19:17:17Z")

</div>

Thanks! That's what I have been thinking! 🙂

On 2 September 2014 13:15, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com) wrote:

> Hello John ,
> 
> Update by query plugin would be a good choice -  
> [GitHub - yakaz/elasticsearch-action-updatebyquery: ElasticSearch Update By Query action plugin](https://github.com/yakaz/elasticsearch-action-updatebyquery/)  
> Just set a match\_all query.
> 
> Bulk API with updates to all the documents should also work.
> 
> Thanks  
> Vineeth
> 
> On Tue, Sep 2, 2014 at 7:01 PM, John Smith [java.dev.mtl@gmail.com](mailto:java.dev.mtl@gmail.com) wrote:
> 
> > Hi I need to add a new field (with a default) to all documents already  
> > indexed.
> > 
> > I guess bulk update will do it?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/3b0a5b54-a355-4ad7-86a7-286808d4de36%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/zOS6iUkZ3Eo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/zOS6iUkZ3Eo/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DhWg1Jztx%3D6tKXDtzUBMKearj1uEnfvbd9M80VfhOFdw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAMiEuFRRjhvpM%2BSOfzCx%2BfjgwFbv6nL\_vTr39CQRkG3XRmH1QQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAMiEuFRRjhvpM%2BSOfzCx%2BfjgwFbv6nL_vTr39CQRkG3XRmH1QQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:04am UTC](https://discuss.elastic.co/t/add-field-to-all-documents-of-an-index/19572/4 "2017-07-06T01:04:55Z")

</div>


