# Define multiple types in an index

**URL:** <https://discuss.elastic.co/t/define-multiple-types-in-an-index/19464>\
**Category:** Elasticsearch\
**Created:** [August 26, 2014, 1:09pm UTC](https://discuss.elastic.co/t/define-multiple-types-in-an-index/19464 "2014-08-26T13:09:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HansPeterSloot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanspetersloot/32/51132_2.png) [@HansPeterSloot](https://discuss.elastic.co/u/HansPeterSloot)\
**Post date:** [August 26, 2014, 1:09pm UTC](https://discuss.elastic.co/t/define-multiple-types-in-an-index/19464/1 "2014-08-26T13:09:04Z")

</div>

Hello,

I am using elasticsearch 1.3.2 and try to understand elasticsearch (with my  
Oracle background ;-)).  
For testing I use the data available  
on [http://fec.gov/disclosurep/PDownload.do](http://fec.gov/disclosurep/PDownload.do)

There is a datafile for every state of the USA.  
I don't know whether it is a good idea but I want to make 1 index with a  
type for every state.

I want to define the fields and their types in advance.

Can I create the index with type AL and add other types after creation?  
I tried but I was not able to do it.

I created the the folloing index  
curl -XPOST localhost:9200/contributions -d '{  
"settings" : {  
"number\_of\_shards" : 10, "number\_of\_replicas" : 1, "\_index" : true  
},  
"mappings" : {  
"AK" : { "properties" :  
{ "cand\_id" : { "type" : "string" , "index" :  
"not\_analyzed" },  
"cand\_nm" : { "type" : "string" },  
"cmte\_id" : { "type" : "string" }  
}  
}  
, "AL" : {  
"properties" : {  
"cand\_id" : { "type" : "string" , "index" :  
"not\_analyzed" },  
"cand\_nm" : { "type" : "string" },  
"cmte\_id" : { "type" : "string" }  
}  
}  
}  
}'

Can I add types for AR and AZ after creation?  
They have the same column definition.  
Is there a better way to achieve this?

Regards HansP

--  
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/191875fc-8378-4ed1-8ca9-b0f2fbfc2ccc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/191875fc-8378-4ed1-8ca9-b0f2fbfc2ccc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:06am UTC](https://discuss.elastic.co/t/define-multiple-types-in-an-index/19464/2 "2017-07-06T01:06:25Z")

</div>


