# Default mappings for all types in an index (types created on the fly)

**URL:** https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093
**Category:** Elasticsearch
**Created:** [January 3, 2014, 2:12pm UTC](https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093 "2014-01-03T14:12:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Klotz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_klotz/32/855_2.png) [@David\_Klotz](https://discuss.elastic.co/u/David_Klotz)
#### Post date: [January 3, 2014, 2:12pm UTC](https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093/1 "2014-01-03T14:12:40Z")

</div>

Hi,

i have a bit of a hard time understanding how to specify a default mapping  
that is used for all types in an index.

My usage scenario is as follows (inspired by some discussions on this list  
that seemed to advocate for one-type-per-user over  
one-index-per-user-configurations for scalability reasons when you have  
many user-specific documents):

I have an index, named e.g. "contacts", and one predefined type "general"  
in that index (which is used for contacts that are not specific to one  
user, at the moment only this type has any specific mapping). Then, for  
each user, a type "user\_someuserid" is created in the same index.

My problem now is that even after quite some reading of the documentation,  
I can't figure out how to specify one general default mapping for all types  
in an index. I know I could probably do a "put mapping" (with always the  
same mapping) when creating the user-specific type, but if possible I want  
to avoid that since the types get created on the fly when the first  
document is indexed for that user.

The JSON used in all the sub-types of one index will be the same. I already  
tried specifying/changing the "\_default" mapping, but that didn't seem to  
be used for documents in the newly created sub-types.

Any pointers on what (apart from the "put mapping" before the first  
document for each user gets indexed) I could look at to specify one mapping  
that is valid for all types in an index, even types created in the future?

Cheers,  
David

--  
David Klotz, Software-Engineer, fileee GmbH

--  
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/5010053f-58a4-48a2-845a-31c49c68c57f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5010053f-58a4-48a2-845a-31c49c68c57f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [January 3, 2014, 2:24pm UTC](https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093/2 "2014-01-03T14:24:35Z")

</div>

The key for the fallback mapping is _default_ (not \_default)

Jörg

--  
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/CAKdsXoHq4Oma0CHuJf0\_n7DCJyQtfiZ7KGZK6\_LctBOXM0JBkA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHq4Oma0CHuJf0_n7DCJyQtfiZ7KGZK6_LctBOXM0JBkA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![David\_Klotz\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_klotz_2/32/855_2.png) [@David\_Klotz\_2](https://discuss.elastic.co/u/David_Klotz_2)
#### Post date: [January 3, 2014, 4:23pm UTC](https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093/3 "2014-01-03T16:23:13Z")

</div>

Thanks a lot! That was too easy, should have looked more closely  
there. I think I even tried with _default_ once, but got confused  
(i.e. thought it didn't work) because analyze requests seem to ignore  
the _default_ mapping until the first document is indexed in that  
index/type.

-David

On Fri, Jan 3, 2014 at 3:24 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com)  
[joergprante@gmail.com](mailto:joergprante@gmail.com) wrote:

> The key for the fallback mapping is _default_ (not \_default)
> 
> Jörg
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/3YbnxjEUQzk/unsubscribe](https://groups.google.com/d/topic/elasticsearch/3YbnxjEUQzk/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/CAKdsXoHq4Oma0CHuJf0\_n7DCJyQtfiZ7KGZK6\_LctBOXM0JBkA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHq4Oma0CHuJf0_n7DCJyQtfiZ7KGZK6_LctBOXM0JBkA%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAF9xhsdpxrDma5T%2B%3DoqxcX0q1X%3DTB1ef%2BVWULJ\_1%3D\_m2biAddw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAF9xhsdpxrDma5T%2B%3DoqxcX0q1X%3DTB1ef%2BVWULJ_1%3D_m2biAddw%40mail.gmail.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, 1:58am UTC](https://discuss.elastic.co/t/default-mappings-for-all-types-in-an-index-types-created-on-the-fly/15093/4 "2017-07-06T01:58:28Z")

</div>


