# How to add document metadata?

**URL:** https://discuss.elastic.co/t/how-to-add-document-metadata/9297
**Category:** Elasticsearch
**Created:** [October 9, 2012, 10:40pm UTC](https://discuss.elastic.co/t/how-to-add-document-metadata/9297 "2012-10-09T22:40:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![TheOutlander\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theoutlander_2/32/2614_2.png) [@TheOutlander\_2](https://discuss.elastic.co/u/TheOutlander_2)
#### Post date: [October 9, 2012, 10:40pm UTC](https://discuss.elastic.co/t/how-to-add-document-metadata/9297/1 "2012-10-09T22:40:08Z")

</div>

I want to associate metadata with a document after it has been inserted.  
What is the ideal way to do this?

I saw the recent feature about updating elements in a document, but that  
will re-index the entire document. Is that what I should be using? I was  
thinking of adding elements like document.metadata.var1,  
document.metadata.var2, etc.

Thanks,  
Nick

--

---

<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: [October 10, 2012, 5:36am UTC](https://discuss.elastic.co/t/how-to-add-document-metadata/9297/2 "2012-10-10T05:36:33Z")

</div>

IMHO, get your document from ES and add metadata, then push it again to ES.  
(So yes, reindex it all)

My 2 cents

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 10 oct. 2012 à 00:40, TheOutlander [theoutlander@gmail.com](mailto:theoutlander@gmail.com) a écrit :

> I want to associate metadata with a document after it has been inserted. What is the ideal way to do this?
> 
> I saw the recent feature about updating elements in a document, but that will re-index the entire document. Is that what I should be using? I was thinking of adding elements like document.metadata.var1, document.metadata.var2, etc.
> 
> ## Thanks, Nick

--

---

<div class="post-metadata">

### Author: ![TheOutlander\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theoutlander_2/32/2614_2.png) [@TheOutlander\_2](https://discuss.elastic.co/u/TheOutlander_2)
#### Post date: [October 19, 2012, 1:08am UTC](https://discuss.elastic.co/t/how-to-add-document-metadata/9297/3 "2012-10-19T01:08:16Z")

</div>

Almost forgot I had asked this question. Thanks for the answer. I'm  
thinking of using the update document call that was recently released.  
However, someone mentioned that Lucene supports an add field call which in  
essence is add metadata.

Thanks,  
Nick

On Tuesday, October 9, 2012 10:36:42 PM UTC-7, David Pilato wrote:

> IMHO, get your document from ES and add metadata, then push it again to ES.  
> (So yes, reindex it all)
> 
> My 2 cents
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 10 oct. 2012 à 00:40, TheOutlander \<[theout...@gmail.com](mailto:theout...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> I want to associate metadata with a document after it has been inserted.  
> What is the ideal way to do this?
> 
> I saw the recent feature about updating elements in a document, but that  
> will re-index the entire document. Is that what I should be using? I was  
> thinking of adding elements like document.metadata.var1,  
> document.metadata.var2, etc.
> 
> Thanks,  
> Nick
> 
> --

--

---

<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, 3:07am UTC](https://discuss.elastic.co/t/how-to-add-document-metadata/9297/4 "2017-07-06T03:07:59Z")

</div>


