Define multiple types in an index


(HansPeterSloot) #1

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

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/191875fc-8378-4ed1-8ca9-b0f2fbfc2ccc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2