# Need suggestion ----- about Mappings

**URL:** <https://discuss.elastic.co/t/need-suggestion-about-mappings/12150>\
**Category:** Elasticsearch\
**Created:** [May 28, 2013, 1:31pm UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150 "2013-05-28T13:31:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammad\_rafi\_g](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mohammad\_rafi\_g](https://discuss.elastic.co/u/mohammad_rafi_g)\
**Post date:** [May 28, 2013, 1:31pm UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150/1 "2013-05-28T13:31:12Z")

</div>

Hi To All.,

```
         Actually., First I will discuss about my Requirement, is., 

```

Suppose we have 3 files like.,  
1. abc\_1234\_20130502201030\_cdr65.txt  
2. abc\_1234\_20130502201030\_dat66.txt  
3. abc\_1234\_20130502201030\_log67.txt  
now., we have to index above data into ElasticSearch. But as per  
my requirement  
we have to take the index name as "20130502201030" \<which is the 3rd word  
in file name\>  
and index type as "cdr65" \<which is the 4rt word in file name\>for first  
file and so on.

That means as per my file name we have to create index and index type  
dynamically.

In these 3 files we have date format like "yyyymmddhhmiss" format. So we  
have used the put-mapping for configure the date field as we have for the  
three index types.  
Upto here all is fine.

Problem is:  
later we have got some more files for which we need to store them in same  
index with different index type.  
but unfortunately.,

1. when we are trying to add some more mappings[for new types] for existing  
index we are getting "Index Already Exists" Exception.
2. and also if we load data with different index type in the same index  
data is loading, but the date field is taken as "string".

Can Any One Know About This., Please Tell me  
A. How to do mappings for new types for existing Index.  
B. Why I am getting exception for adding mapping[for new type] for  
existing index?  
C. Is There any approach for give the default date format for whole index  
so that  
if we Index new date fields [with "yyyymmddhhmmss" format]  
then new field create as the default date format only.  
[And if i create new type then default date format only  
taken for new date fields.]  
D. If My Requirement is wrong please tell me how to solve the new date  
format must fix as date only when we index?

Thanks and Regards to All,  
Mohammad Rafi.

--  
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:** ![mohammad\_rafi\_g](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mohammad\_rafi\_g](https://discuss.elastic.co/u/mohammad_rafi_g)\
**Post date:** [May 29, 2013, 6:49am UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150/2 "2013-05-29T06:49:24Z")

</div>

Hi to All.,

```
      I have some more Question in my Mind.. they are,

```

1. 

```
            if we create a index with type [say, type1] which has 

```

the mappings for custom date fields.  
now if we want to use the same type1[existing index type which has date  
format mappings settings] for new index. is it Possible?  
2. is it possible to have a default mapping settings so  
that for all newly created index  
will check date format like "yyyymmddhhmmss" instead of "dateoptionaltime"  
when we pass date in string format?

If Any One Know about this issue, Please tell me.

Thanks and Regards to All,  
Mohammad Rafi.

--  
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:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [May 29, 2013, 7:43am UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150/3 "2013-05-29T07:43:17Z")

</div>

Hi,

A. This one should work fine:

> **[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.

B. Check if A. works fine  
C. As far as I know there are 2 possibilities:

1. Dynamic templates: you can create indices templates but you have to know  
all the document types in an index:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/)
2. Changing date format for a root object type:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type/)

Best regards.

2013/5/28 rafi [me.mrafi.en@gmail.com](mailto:me.mrafi.en@gmail.com)

> Hi To All.,
> 
> ```
> Actually., First I will discuss about my Requirement, is.,
> 
> ```
> 
> Suppose we have 3 files like.,  
> 1. abc\_1234\_20130502201030\_cdr65.txt  
> 2. abc\_1234\_20130502201030\_dat66.txt  
> 3. abc\_1234\_20130502201030\_log67.txt  
> now., we have to index above data into Elasticsearch. But as per  
> my requirement  
> we have to take the index name as "20130502201030" \<which is the 3rd word  
> in file name\>  
> and index type as "cdr65" \<which is the 4rt word in file name\>for first  
> file and so on.
> 
> That means as per my file name we have to create index and index type  
> dynamically.
> 
> In these 3 files we have date format like "yyyymmddhhmiss" format. So we  
> have used the put-mapping for configure the date field as we have for the  
> three index types.  
> Upto here all is fine.
> 
> Problem is:  
> later we have got some more files for which we need to store them in same  
> index with different index type.  
> but unfortunately.,
> 
> 1. when we are trying to add some more mappings[for new types] for  
> existing index we are getting "Index Already Exists" Exception.
> 2. and also if we load data with different index type in the same index  
> data is loading, but the date field is taken as "string".
> 
> Can Any One Know About This., Please Tell me  
> A. How to do mappings for new types for existing Index.  
> B. Why I am getting exception for adding mapping[for new type] for  
> existing index?  
> C. Is There any approach for give the default date format for whole index  
> so that  
> if we Index new date fields [with "yyyymmddhhmmss" format]  
> then new field create as the default date format only.  
> [And if i create new type then default date format only  
> taken for new date fields.]  
> D. If My Requirement is wrong please tell me how to solve the new date  
> format must fix as date only when we index?
> 
> Thanks and Regards to All,  
> Mohammad Rafi.
> 
> --  
> 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:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [May 29, 2013, 7:46am UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150/4 "2013-05-29T07:46:49Z")

</div>

1. It should be possible, because each ES index is fully separated so the  
mappings and types are separated too. But check this out to be sure 🙂
2. Please check  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type/)

Best regards.

2013/5/29 rafi [me.mrafi.en@gmail.com](mailto:me.mrafi.en@gmail.com)

> Hi to All.,
> 
> ```
> I have some more Question in my Mind.. they are,
> 
> ```
> 
> 1. 
> 
> ```
> if we create a index with type [say, type1] which has
> 
> ```
> 
> the mappings for custom date fields.  
> now if we want to use the same type1[existing index type which has date  
> format mappings settings] for new index. is it Possible?  
> 2. is it possible to have a default mapping settings so  
> that for all newly created index  
> will check date format like "yyyymmddhhmmss" instead of "dateoptionaltime"  
> when we pass date in string format?
> 
> If Any One Know about this issue, Please tell me.
> 
> Thanks and Regards to All,  
> Mohammad Rafi.
> 
> --  
> 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:** ![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:34am UTC](https://discuss.elastic.co/t/need-suggestion-about-mappings/12150/5 "2017-07-06T02:34:11Z")

</div>


