# Advise for mapping options

**URL:** <https://discuss.elastic.co/t/advise-for-mapping-options/6174>\
**Category:** Elasticsearch\
**Created:** [December 16, 2011, 7:35am UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174 "2011-12-16T07:35:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [December 16, 2011, 7:35am UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/1 "2011-12-16T07:35:59Z")

</div>

Hi,

I have multi-tenant application in which I want to index customer data, new  
tenants can come very frequent. Each tenant has in advance known what index  
type it needs. But, common for all indexes (types and tenants) is 3 fields  
: date, id of data and user account and I have to not store \_source.

I need to provide mapping for all indexes / types once I start to index new  
tenant. But, also possible that new index type will be added for all  
tenants.  
So, I think best solution is default-mapping.json, but may be I'm missing  
something and there better solution ?

Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 16, 2011, 5:08pm UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/2 "2011-12-16T17:08:48Z")

</div>

index templates can also help:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

.

On Fri, Dec 16, 2011 at 9:35 AM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> Hi,
> 
> I have multi-tenant application in which I want to index customer data,  
> new tenants can come very frequent. Each tenant has in advance known what  
> index type it needs. But, common for all indexes (types and tenants) is 3  
> fields : date, id of data and user account and I have to not store \_source.
> 
> I need to provide mapping for all indexes / types once I start to index  
> new tenant. But, also possible that new index type will be added for all  
> tenants.  
> So, I think best solution is default-mapping.json, but may be I'm missing  
> something and there better solution ?
> 
> Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [December 16, 2011, 5:12pm UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/3 "2011-12-16T17:12:37Z")

</div>

Can I set template that will match any type ?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 20, 2011, 3:24pm UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/4 "2011-12-20T15:24:12Z")

</div>

You can set the type name as _default_, and then it will match any type.

On Fri, Dec 16, 2011 at 7:12 PM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> Can I set template that will match any type ?

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [December 20, 2011, 4:39pm UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/5 "2011-12-20T16:39:35Z")

</div>

Thank You

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [December 21, 2011, 10:20pm UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/6 "2011-12-21T22:20:40Z")

</div>

Hi

I have a question regarding get template from java.  
I found put template, and I also found cluster state (getting all template)  
, but somehow I can't find get single template by name in java.

Thank You.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 22, 2011, 12:50am UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/7 "2011-12-22T00:50:48Z")

</div>

There isn't one, you get it from the cluster state. Here is the code for  
hte REST endpoint for get template which uses the Java API:  
[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java)  
.

On Thu, Dec 22, 2011 at 12:20 AM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> Hi
> 
> I have a question regarding get template from java.  
> I found put template, and I also found cluster state (getting all  
> template) , but somehow I can't find get single template by name in java.
> 
> Thank You.

---

<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:44am UTC](https://discuss.elastic.co/t/advise-for-mapping-options/6174/8 "2017-07-06T03:44:39Z")

</div>


