I can't decipher what's wrong with my code.
Im using the elasticsearch-php package > json-doc,
elasticsearch-php > php-doc.
my putMapping function
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
{"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}