# putMapping "reason":"Rejecting mapping update to \[pets\] as the final mapping would have more than 1 type: \[bird, dog\]"}\]

**URL:** <https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349>\
**Category:** Elasticsearch\
**Created:** [February 4, 2018, 2:36pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349 "2018-02-04T14:36:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickclasener](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@nickclasener](https://discuss.elastic.co/u/nickclasener)\
**Post date:** [February 4, 2018, 2:36pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349/1 "2018-02-04T14:36:31Z")

</div>

I can't decipher what's wrong with my code.  
Im using the [elasticsearch-php package \> json-doc](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_index_management_operations.html#_put_mappings_api),  
[elasticsearch-php \> php-doc](https://github.com/elastic/elasticsearch-php/blob/6.0/docs/index-operations.asciidoc#put-mappings-api).  
my putMapping function

```php
	public function elasticsearchData()
	{
		$params = [
			'index' => 'pets',
			'type' => 'bird',
			'body' => [
				'bird' => [
					'_source' => [
						'enabled' => true
					],
					'properties' => [
						'name' => ['type' => 'text'],
						'age' => ['type' => 'long'],
						'gender' => ['type' => 'boolean'],
						'color' => ['type' => 'text'],
						'braveBird' => ['type' => 'boolean'],
						'hometown' => ['type' => 'text'],
						'about' => ['type' => 'text'],
						'registered' => ['type' => 'date'],
					]
				]
			]
		];

		$response = $this->elasticsearch->indices()->putMapping($params);
		dd($response);

		$params = [
			'index' => 'pets',
			'type' => 'bird'
		];

		$response = $this->elasticsearch->indices()->getMapping($params);
		dump($response);
	}

```

The response i get

```auto
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [pets] as the final mapping would have more than 1 type: [bird, dog]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [pets] as the final mapping would have more than 1 type: [bird, dog]"},"status":400}

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 4, 2018, 3:28pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349/2 "2018-02-04T15:28:02Z")

</div>

You already have a type defined for your index.  
You can't add another one in 6.x.

---

<div class="post-metadata">

**Author:** ![nickclasener](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@nickclasener](https://discuss.elastic.co/u/nickclasener)\
**Post date:** [February 4, 2018, 3:33pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349/3 "2018-02-04T15:33:15Z")

</div>

Yes i read that since 6.0 you can only have single types...?  
What this exactly means isn't yet clear to me  
Do i structure it like this?  
`Index: dog` `type: pet`  
`index: bird` `type: pet`

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 4, 2018, 3:53pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349/4 "2018-02-04T15:53:52Z")

</div>

You can read this: [https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch](https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch)

---

<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:** [March 4, 2018, 3:53pm UTC](https://discuss.elastic.co/t/putmapping-reason-rejecting-mapping-update-to-pets-as-the-final-mapping-would-have-more-than-1-type-bird-dog/118349/5 "2018-03-04T15:53:52Z")

</div>

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