# Could mapping \_meta be used for each property or entire mapping only?

**URL:** <https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659>\
**Category:** Elasticsearch\
**Created:** [April 22, 2013, 3:51pm UTC](https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659 "2013-04-22T15:51:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [April 22, 2013, 3:51pm UTC](https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659/1 "2013-04-22T15:51:27Z")

</div>

Could \_meta be only used on mapping level or could it be specified for  
every property defined in the mapping as well?  
I would really like to be able to annotate my properties for application  
use (i.e. displayName, whether it should be used for faceting and which of  
propertie's multifields should be used for that etc)

--  
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:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [April 22, 2013, 4:03pm UTC](https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659/2 "2013-04-22T16:03:43Z")

</div>

Meta can only be applied to the root of the type mapping. You can use  
comments in your mapping at any level but the comments on not returned  
when performing a GET mapping so I am not sure how useful that will be  
for you.

> <https://github.com/elastic/elasticsearch/issues/1394>
>
> Hi,
> 
> I would like to be able to send comment in mapping as I managed mappings in… files.
> So by now, it's not allowed to send that kind of mapping :
> 
> \`\`\`
> curl -XPUT http://localhost:9200/twitter/tweet/\_mapping -d @tweet.json
> \`\`\`
> 
> with tweet.json content
> 
> \`\`\` javascript
> /\* Test comment \*/
> {
> "tweet":{
> "properties":{
> "user":{
> "type":"string" // This a comment on field
> }
> }
> }
> }
> \`\`\`
> 
> You get an error like :
> 
> \`\`\`
> {"error":"MapperParsingException\[Failed to parse mapping definition\]; nested: JsonParseException\[Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW\_COMMENTS' not enabled for parser)\\n at \[Source: /\* Test comment \*/{ \\"tweet\\":{ \\"properties\\":{ \\"user\\":{ \\"type\\":\\"string\\" } } }}; line: 1, column: 2\]\]; ","status":400}
> \`\`\`
> 
> I think it's only need to set Jackson property as follow
> 
> \`\`\` java
> objectMapper.configure(JsonParser.Feature.ALLOW\_COMMENTS, true);
> \`\`\`
> 
> Could it have any side effects ?
> 
> Thanks.
> David.

Thanks,  
Matt Weber

On Mon, Apr 22, 2013 at 8:51 AM, AlexR [roytmana@gmail.com](mailto:roytmana@gmail.com) wrote:

> Could \_meta be only used on mapping level or could it be specified for every  
> property defined in the mapping as well?  
> I would really like to be able to annotate my properties for application use  
> (i.e. displayName, whether it should be used for faceting and which of  
> propertie's multifields should be used for that etc)
> 
> --  
> 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:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [April 22, 2013, 4:19pm UTC](https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659/3 "2013-04-22T16:19:26Z")

</div>

Thanks Matt.  
Maintaining a large mappings file is pretty hard but maintaining (and  
syncing) properties metadata outside of the mapping structure is a real  
pain. I was hoping to use \_meta tag for it.  
I may have to use my own meta-model to generate mappings and other  
artifacts from it but it will not be dramatically more concise than ES  
mappings if I want to support all mapping options so I decided against it.  
Now I guess I may just go with it. The biggest benefit (in addition to be  
able to store my own metadata) would be ability to have certain transforms  
such as chained multifield mapping or macros that could be expanded into ES  
mapping file

On Monday, April 22, 2013 12:03:43 PM UTC-4, Matt Weber wrote:

> Meta can only be applied to the root of the type mapping. You can use  
> comments in your mapping at any level but the comments on not returned  
> when performing a GET mapping so I am not sure how useful that will be  
> for you.
> 
> [Comments are not allowed in mapping · Issue #1394 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1394)
> 
> Thanks,  
> Matt Weber
> 
> On Mon, Apr 22, 2013 at 8:51 AM, AlexR \<[royt...@gmail.com](mailto:royt...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Could \_meta be only used on mapping level or could it be specified for  
> > every  
> > property defined in the mapping as well?  
> > I would really like to be able to annotate my properties for application  
> > use  
> > (i.e. displayName, whether it should be used for faceting and which of  
> > propertie's multifields should be used for that etc)
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > 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:40am UTC](https://discuss.elastic.co/t/could-mapping--meta-be-used-for-each-property-or-entire-mapping-only/11659/4 "2017-07-06T02:40:06Z")

</div>


