# Add/Remove fields to/from existing index

**URL:** <https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931>\
**Category:** Elasticsearch\
**Created:** [July 25, 2013, 7:34am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931 "2013-07-25T07:34:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohit\_Kumar](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mohit\_Kumar](https://discuss.elastic.co/u/mohit_Kumar)\
**Post date:** [July 25, 2013, 7:34am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931/1 "2013-07-25T07:34:44Z")

</div>

Hi Folks,  
how can we add/remove a field from existing index.?

Regrads  
Mohit Kumar Yadav  
(MCA/BBA)  
Assocaite Software Developer  
Next Gen Invent Corporation, Noida  
Email Id : [mohit.kumar@ngiventures.com](mailto:mohit.kumar@ngiventures.com),mohit.kumar.ngi@gmail.com

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 25, 2013, 7:57am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931/2 "2013-07-25T07:57:30Z")

</div>

You have to reindex all documents without the field.  
But if you reindex using the same type, field will still appear in mapping (that's not really an issue IMHO).

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 25 juil. 2013 à 09:34, Mohit Kumar Yadav [mohit.kumar.ngi@gmail.com](mailto:mohit.kumar.ngi@gmail.com) a écrit :

> Hi Folks,  
> how can we add/remove a field from existing index.?
> 
> Regrads  
> Mohit Kumar Yadav  
> (MCA/BBA)  
> Assocaite Software Developer  
> Next Gen Invent Corporation, Noida  
> Email Id : [mohit.kumar@ngiventures.com](mailto:mohit.kumar@ngiventures.com),mohit.kumar.ngi@gmail.com
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mohit\_Kumar](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mohit\_Kumar](https://discuss.elastic.co/u/mohit_Kumar)\
**Post date:** [July 25, 2013, 9:59am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931/3 "2013-07-25T09:59:48Z")

</div>

Hi David Pilato,  
thank you very much for yours guidance.. I will go through yours guidance.  
here is another question related to update query.  
I was going through the elasticsearch website an found update tutorial for elasticsearch. [http://www.elasticsearch.org/guide/reference/api/update/](http://www.elasticsearch.org/guide/reference/api/update/)  
from there I picked a query to add a new field in document.

curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{  
"script" : "ctx.\_source.text = "some text""  
}'

but when i am running this query, I am getting following error. can you help me in understanding why this error is comming.

{"error":"JsonParseException[Unexpected character ('s' (code 40)): was expecting  
comma to separate OBJECT entries\n at [Source: [B@58c3af97; line: 1, column: 42]]","status":500}

once again thank you for helping.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 26, 2013, 10:57am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931/4 "2013-07-26T10:57:54Z")

</div>

I suppose that it's due because you did not escape " in "some text"

Try with 'some text' or with "some text"

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 25 juil. 2013 à 11:59, "mohit.Kumar" [mohit.kumar.ngi@gmail.com](mailto:mohit.kumar.ngi@gmail.com) a écrit :

> Hi David Pilato,  
> thank you very much for yours guidance.. I will go through yours guidance.  
> here is another question related to update query.  
> I was going through the elasticsearch website an found update tutorial for  
> elasticsearch. [http://www.elasticsearch.org/guide/reference/api/update/](http://www.elasticsearch.org/guide/reference/api/update/)  
> from there I picked a query to add a new field in document.
> 
> curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{  
> "script" : "ctx.\_source.text = "some text""  
> }'
> 
> but when i am running this query, I am getting following error. can you help  
> me in understanding why this error is comming.
> 
> {"error":"JsonParseException[Unexpected character ('s' (code 40)): was  
> expecting  
> comma to separate OBJECT entries\n at [Source: [B@58c3af97; line: 1, column: 42]]","status":500}
> 
> once again thank you for helping.
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Add-Remove-fields-to-from-existing-index-tp4038627p4038633.html](http://elasticsearch-users.115913.n3.nabble.com/Add-Remove-fields-to-from-existing-index-tp4038627p4038633.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:24am UTC](https://discuss.elastic.co/t/add-remove-fields-to-from-existing-index/12931/5 "2017-07-06T02:24:21Z")

</div>


