Error when creating different Type in Same Index Name


(Raksha Choudhary) #1

Hi all,

I am trying to create a new Type in same Index as below.

I already have created a index like below, which has more than 200 data.

post _bulk
{"index":{"_index" : "bank", "_type" : "account", "_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}

Because I am just learning elasticsearch query, so wanted to work on lesser data. So I thought of creating the same index with different Type name (with same data , just 10-15 row of data)

post _bulk
{"index":{"_index" : "bank", "_type" : "fewaccounts", "_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}

When trying to run above query, getting error as below

"index": {
"_index": "bank",
"_type": "fewaccounts",
"_id": "6",
"status": 400,
"error": {
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [bank] as the final mapping would have more than 1 type: [fewaccounts, account]"

I know for learning purpose , i can create a new index and new type. But I would like to know why am I getting this error, and how to fix it.

Thanks in advance.


(Christian Dahlqvist) #2

From version 6.0, it is no longer possible to have more than one type in a newly created index. The reason for this is that types are being deprecated.


(Raksha Choudhary) #3

oh ok.. I am using version 6.2

That means Its not at all possible to create more than one type for same Index.

Thanks a lot christian for the quick reply.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.