# Help setting up bulk index

**URL:** <https://discuss.elastic.co/t/help-setting-up-bulk-index/130024>\
**Category:** Elasticsearch\
**Created:** [April 30, 2018, 12:11pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024 "2018-04-30T12:11:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aswamina](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@aswamina](https://discuss.elastic.co/u/aswamina)\
**Post date:** [April 30, 2018, 12:11pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/1 "2018-04-30T12:11:51Z")

</div>

Hi,

I have a sample index called "restaurants" with an explicit mapping as follows

{  
"mappings": {  
"categories": {  
"\_source": {  
"enabled": true  
},  
"numeric\_detection": true,  
"date\_detection": true,  
"properties": {  
"restaurant": {  
"properties": {  
"name": {  
"type": "text"  
},  
"current\_address": {  
"type": "text"  
},  
"zip": {  
"type": "text"  
},  
"location": {  
"type": "geo\_point"  
}  
}  
}  
}  
}

This is the command to create the index:  
curl -XPUT 'localhost:9200/restaurants?pretty' -d @restaurant-mappings.json -H 'Content-type: application/json'

I try the bulk method of adding documents. The first command works ok  
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/restaurants/mediterranean/\_bulk?pretty&refresh' --data-binary @"mediterranean\_restaurant\_data.json"

However the second command throws an error:  
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/restaurants/chinese/\_bulk?pretty&refresh' --data-binary @"chinese\_restaurant\_data.json"

{  
"took" : 42,  
"errors" : true,  
"items" : [  
{  
"index" : {  
"\_index" : "restaurants",  
"\_type" : "chinese",  
"\_id" : "VOhnGnMBGURHDTdYpAzX",  
"status" : 400,  
"error" : {  
"type" : "illegal\_argument\_exception",  
"reason" : "Rejecting mapping update to [restaurants] as the final mapping would have more than 1 type: [mediterranean, chinese]"  
}  
}  
}  
]  
}

What am I doing wrong here ?

Thanks,  
AS

---

<div class="post-metadata">

**Author:** ![arunravimv](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@arunravimv](https://discuss.elastic.co/u/arunravimv)\
**Post date:** [April 30, 2018, 1:00pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/2 "2018-04-30T13:00:03Z")

</div>

Which version es are you using ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 30, 2018, 1:14pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/3 "2018-04-30T13:14:06Z")

</div>

In Elasticsearch 6.x, it is no longer possible to create indices with more than one type, which is why you are seeing the error. [This blog post](https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch) describes this change and the reasons behind it.

---

<div class="post-metadata">

**Author:** ![aswamina](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@aswamina](https://discuss.elastic.co/u/aswamina)\
**Post date:** [April 30, 2018, 2:15pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/4 "2018-04-30T14:15:29Z")

</div>

Thanks for the reply. So in this case, would i create a type index for "mediterranean" restaurants and another one for "chinese" restaurants and just reference them via a "type" field in the properties, correct ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 30, 2018, 2:20pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/5 "2018-04-30T14:20:19Z")

</div>

Yes, add that as a field in the document so you can filter and group by it later.

---

<div class="post-metadata">

**Author:** ![aswamina](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@aswamina](https://discuss.elastic.co/u/aswamina)\
**Post date:** [April 30, 2018, 2:29pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/6 "2018-04-30T14:29:29Z")

</div>

Thanks. Its clear now.

---

<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:** [May 28, 2018, 2:29pm UTC](https://discuss.elastic.co/t/help-setting-up-bulk-index/130024/7 "2018-05-28T14:29:38Z")

</div>

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