# Reindex while edit documents using scan api

**URL:** https://discuss.elastic.co/t/reindex-while-edit-documents-using-scan-api/14195
**Category:** Elasticsearch
**Created:** [October 31, 2013, 5:04pm UTC](https://discuss.elastic.co/t/reindex-while-edit-documents-using-scan-api/14195 "2013-10-31T17:04:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sashao](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sashao](https://discuss.elastic.co/u/sashao)
#### Post date: [October 31, 2013, 5:04pm UTC](https://discuss.elastic.co/t/reindex-while-edit-documents-using-scan-api/14195/1 "2013-10-31T17:04:09Z")

</div>

Hello guys,  
We need to remove part of the fields from the documents to shrink the index size.  
After some googling my conclusions are:

1. there is no choice and we have to reindex documents.
2. it worse to do it using scan and bulk update api's.

My questions is - what is the best way to edit document:  
One way I see is to get the \_source field and edit it.  
While another way I'm considering is to use the partial\_fields option, which actually looks a way more convenient to deal with.  
The problem is I'm not sure that the whole information that needed to reindex the document in the proper way will exist in the returned results. In other words can I use the returned fields to reindex without loosing the information or I have to use \_source?

Thanks!!!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [November 14, 2013, 8:49am UTC](https://discuss.elastic.co/t/reindex-while-edit-documents-using-scan-api/14195/2 "2013-11-14T08:49:49Z")

</div>

Hey,

the question is: Do you really have to remove the fields from your index or  
is it sufficient to mark them as not\_analyzed in your mapping? I would test  
that out, before removing needed data, which then needs to be queried maybe  
from another data store, resulting in huge query roundtrips again.

Regarding changing your document. Getting the source, changing the JSON and  
reindexing might be the best way to go here. I would always go with the  
source, but this depends if you excluded something from it, when indexing  
(I usually try not to do that to prevent exactly that situation).

--Alex

On Thu, Oct 31, 2013 at 6:04 PM, sashao [alexander.ostrikov@gmail.com](mailto:alexander.ostrikov@gmail.com)wrote:

> Hello guys,  
> We need to remove part of the fields from the documents to shrink the index  
> size.  
> After some googling my conclusions are:
> 
> 1. there is no choice and we have to reindex documents.
> 2. it worse to do it using scan and bulk update api's.
> 
> My questions is - what is the best way to edit document:  
> One way I see is to get the \_source field and edit it.  
> While another way I'm considering is to use the partial\_fields option,  
> which  
> actually looks a way more convenient to deal with.  
> The problem is I'm not sure that the whole information that needed to  
> reindex the document in the proper way will exist in the returned results.  
> In other words can I use the returned fields to reindex without loosing the  
> information or I have to use \_source?
> 
> Thanks!!!
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/reindex-while-edit-documents-using-scan-api-tp4043548.html](http://elasticsearch-users.115913.n3.nabble.com/reindex-while-edit-documents-using-scan-api-tp4043548.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).

--  
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:07am UTC](https://discuss.elastic.co/t/reindex-while-edit-documents-using-scan-api/14195/3 "2017-07-06T02:07:14Z")

</div>


