# Mapping templates for \_types (not indices)

**URL:** <https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550>\
**Category:** Elasticsearch\
**Created:** [April 11, 2013, 2:01pm UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550 "2013-04-11T14:01:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mil\_Werns](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@Mil\_Werns](https://discuss.elastic.co/u/Mil_Werns)\
**Post date:** [April 11, 2013, 2:01pm UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/1 "2013-04-11T14:01:26Z")

</div>

Hi, is it possible to create templates (using wildcards) for _\_type_ (not index) mappings?  
I mean something like this:

...  
"mappings" : {  
"_foo_\*" : { // this is a _\_type_  
"\_source" : { "enabled" : false }  
}  
}  
...

I know the _default_ value, but I don't want to apply mappings to all types. Instead the mapping should only be applied to dynamically created foo\* \_types (e.g. fooBar1, fooBar2, ...) etc.

BTW: Is it problem to use 100-1000 different types in an index? I know that a \_type has some overhead (mapping settings etc.), but apart from this: Do you expect any problems with this number of \_types?

Thank you.

--  
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:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 12, 2013, 5:20pm UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/2 "2013-04-12T17:20:35Z")

</div>

Why do you need so many different types if they all have the same mappings?

On Thursday, April 11, 2013 10:01:26 AM UTC-4, Mil Werns wrote:

> Hi, is it possible to create templates (using wildcards) for _\_type_ (not index) mappings?  
> I mean something like this:
> 
> ...  
> "mappings" : {  
> "_foo_\*" : { // this is a _\_type_  
> "\_source" : { "enabled" : false }  
> }  
> }  
> ...
> 
> I know the _default_ value, but I don't want to apply mappings to all types. Instead the mapping should only be applied to dynamically created foo\* \_types (e.g. fooBar1, fooBar2, ...) etc.
> 
> BTW: Is it problem to use 100-1000 different types in an index? I know that a \_type has some overhead (mapping settings etc.), but apart from this: Do you expect any problems with this number of \_types?
> 
> Thank you.

--  
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:** ![Mil\_Werns](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@Mil\_Werns](https://discuss.elastic.co/u/Mil_Werns)\
**Post date:** [April 14, 2013, 9:13am UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/3 "2013-04-14T09:13:33Z")

</div>

Why do you need so many different types if they all have the same mappings?

> 

I want to partition my data on a weekly basis: cw01, cw02, ...

> On Thursday, April 11, 2013 10:01:26 AM UTC-4, Mil Werns wrote:
> 
> > Hi, is it possible to create templates (using wildcards) for _\_type_ (not index) mappings?  
> > I mean something like this:
> > 
> > ...  
> > "mappings" : {  
> > "_foo_\*" : { // this is a _\_type_  
> > "\_source" : { "enabled" : false }  
> > }  
> > }  
> > ...
> > 
> > I know the _default_ value, but I don't want to apply mappings to all types. Instead the mapping should only be applied to dynamically created foo\* \_types (e.g. fooBar1, fooBar2, ...) etc.
> > 
> > BTW: Is it problem to use 100-1000 different types in an index? I know that a \_type has some overhead (mapping settings etc.), but apart from this: Do you expect any problems with this number of \_types?
> > 
> > Thank you.

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [April 14, 2013, 10:35am UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/4 "2013-04-14T10:35:01Z")

</div>

Better to do that using multiple indices, no?

On Sun, Apr 14, 2013 at 11:13 AM, Mil Werns [milwerns@gmail.com](mailto:milwerns@gmail.com) wrote:

> Why do you need so many different types if they all have the same mappings?
> 
> > 
> 
> I want to partition my data on a weekly basis: cw01, cw02, ...
> 
> > On Thursday, April 11, 2013 10:01:26 AM UTC-4, Mil Werns wrote:
> > 
> > > Hi, is it possible to create templates (using wildcards) for _\_type_ (not index) mappings?  
> > > I mean something like this:
> > > 
> > > ...  
> > > "mappings" : {  
> > > "_foo_\*" : { // this is a _\_type_  
> > > "\_source" : { "enabled" : false }  
> > > }  
> > > }  
> > > ...
> > > 
> > > I know the _default_ value, but I don't want to apply mappings to all types. Instead the mapping should only be applied to dynamically created foo\* \_types (e.g. fooBar1, fooBar2, ...) etc.
> > > 
> > > BTW: Is it problem to use 100-1000 different types in an index? I know that a \_type has some overhead (mapping settings etc.), but apart from this: Do you expect any problems with this number of \_types?
> > > 
> > > Thank you.
> > > 
> > > --  
> > > 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:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 14, 2013, 1:59pm UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/5 "2013-04-14T13:59:18Z")

</div>

... or simply add a field that stores a week.

On Sunday, April 14, 2013 6:35:01 AM UTC-4, Clinton Gormley wrote:

> Better to do that using multiple indices, no?
> 
> On Sun, Apr 14, 2013 at 11:13 AM, Mil Werns \<[milw...@gmail.com](mailto:milw...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Why do you need so many different types if they all have the same
> > 
> > > mappings?
> > 
> > I want to partition my data on a weekly basis: cw01, cw02, ...
> > 
> > > On Thursday, April 11, 2013 10:01:26 AM UTC-4, Mil Werns wrote:
> > > 
> > > > Hi, is it possible to create templates (using wildcards) for _\_type_ (not index) mappings?  
> > > > I mean something like this:
> > > > 
> > > > ...
> > > > 
> > > > "mappings" : {  
> > > > "_foo_\*" : { // this is a _\_type_  
> > > > "\_source" : { "enabled" : false }  
> > > > }  
> > > > }  
> > > > ...
> > > > 
> > > > I know the _default_ value, but I don't want to apply mappings to all types. Instead the mapping should only be applied to dynamically created foo\* \_types (e.g. fooBar1, fooBar2, ...) etc.
> > > > 
> > > > BTW: Is it problem to use 100-1000 different types in an index? I know that a \_type has some overhead (mapping settings etc.), but apart from this: Do you expect any problems with this number of \_types?
> > > > 
> > > > Thank you.
> > > > 
> > > > --  
> > > > 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:41am UTC](https://discuss.elastic.co/t/mapping-templates-for--types-not-indices/11550/6 "2017-07-06T02:41:14Z")

</div>


