# Is it possible to rename a field in ES?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397
**Category:** Elasticsearch
**Created:** [September 16, 2011, 7:13pm UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397 "2011-09-16T19:13:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![datadev](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@datadev](https://discuss.elastic.co/u/datadev)
#### Post date: [September 16, 2011, 7:13pm UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/1 "2011-09-16T19:13:12Z")

</div>

Suppose I create an index X with type Y and add 100,000 documents containing  
a field 'foo'.

Is there a command I can use to atomically rename the field name from 'foo'  
to 'bar', or would I have to reindex all 100,000 documents with the new  
field name?

Thanks.

---

<div class="post-metadata">

### Author: ![danoyoung](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@danoyoung](https://discuss.elastic.co/u/danoyoung)
#### Post date: [September 16, 2011, 7:16pm UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/2 "2011-09-16T19:16:03Z")

</div>

I believe you'll need to reindex.

On Fri, Sep 16, 2011 at 1:13 PM, datadev [nji@adinfocenter.com](mailto:nji@adinfocenter.com) wrote:

> Suppose I create an index X with type Y and add 100,000 documents  
> containing a field 'foo'.
> 
> Is there a command I can use to atomically rename the field name from 'foo'  
> to 'bar', or would I have to reindex all 100,000 documents with the new  
> field name?
> 
> Thanks.

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [September 16, 2011, 9:59pm UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/3 "2011-09-16T21:59:11Z")

</div>

Yes, once a field is set, there is no way to rename it.

On Fri, Sep 16, 2011 at 10:16 PM, Dan Young [danoyoung@gmail.com](mailto:danoyoung@gmail.com) wrote:

> I believe you'll need to reindex.
> 
> On Fri, Sep 16, 2011 at 1:13 PM, datadev [nji@adinfocenter.com](mailto:nji@adinfocenter.com) wrote:
> 
> > Suppose I create an index X with type Y and add 100,000 documents  
> > containing a field 'foo'.
> > 
> > Is there a command I can use to atomically rename the field name from  
> > 'foo' to 'bar', or would I have to reindex all 100,000 documents with the  
> > new field name?
> > 
> > Thanks.

---

<div class="post-metadata">

### Author: ![Johnny\_Wang](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Johnny\_Wang](https://discuss.elastic.co/u/Johnny_Wang)
#### Post date: [April 2, 2015, 5:25am UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/4 "2015-04-02T05:25:46Z")

</div>

Or can I add an alias for 'foo'?

On Saturday, September 17, 2011 at 5:59:11 AM UTC+8, kimchy wrote:

> Yes, once a field is set, there is no way to rename it.
> 
> On Fri, Sep 16, 2011 at 10:16 PM, Dan Young \<[dano...@gmail.com](mailto:dano...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > I believe you'll need to reindex.
> > 
> > On Fri, Sep 16, 2011 at 1:13 PM, datadev \<[n...@adinfocenter.com](mailto:n...@adinfocenter.com)  
> > \<javascript:\>\> wrote:
> > 
> > > Suppose I create an index X with type Y and add 100,000 documents  
> > > containing a field 'foo'.
> > > 
> > > Is there a command I can use to atomically rename the field name from  
> > > 'foo' to 'bar', or would I have to reindex all 100,000 documents with the  
> > > new field name?
> > > 
> > > Thanks.

--  
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/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 2, 2015, 9:55pm UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/5 "2015-04-02T21:55:00Z")

</div>

You can create an alias with a filter on a field and then use that, but you  
cannot alias an individual field.

On 2 April 2015 at 16:25, Johnny Wang [archer.wq@gmail.com](mailto:archer.wq@gmail.com) wrote:

> Or can I add an alias for 'foo'?
> 
> On Saturday, September 17, 2011 at 5:59:11 AM UTC+8, kimchy wrote:
> 
> > Yes, once a field is set, there is no way to rename it.
> > 
> > On Fri, Sep 16, 2011 at 10:16 PM, Dan Young [dano...@gmail.com](mailto:dano...@gmail.com) wrote:
> > 
> > > I believe you'll need to reindex.
> > > 
> > > On Fri, Sep 16, 2011 at 1:13 PM, datadev [n...@adinfocenter.com](mailto:n...@adinfocenter.com) wrote:
> > > 
> > > > Suppose I create an index X with type Y and add 100,000 documents  
> > > > containing a field 'foo'.
> > > > 
> > > > Is there a command I can use to atomically rename the field name from  
> > > > 'foo' to 'bar', or would I have to reindex all 100,000 documents with the  
> > > > new field name?
> > > > 
> > > > Thanks.
> > 
> > --  
> > 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/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b8eb7181-bf2c-4367-bb7c-dc3f1244765e%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/CAEYi1X9oo\_g2T%2BnFw5ZSP2H4U6c1-6E3oUNx5b8h4AHYDvngKg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9oo_g2T%2BnFw5ZSP2H4U6c1-6E3oUNx5b8h4AHYDvngKg%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, 12:21am UTC](https://discuss.elastic.co/t/is-it-possible-to-rename-a-field-in-es/5397/6 "2017-07-06T00:21:57Z")

</div>


