Skip to content

Commit

Permalink
Do not arbitrary add include_type_name
Browse files Browse the repository at this point in the history
  • Loading branch information
thePanz committed Aug 28, 2019
1 parent e9c85c9 commit 0687884
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions lib/Elastica/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,9 @@ public function request($path, $method, $data = [], array $query = [])
public function requestEndpoint(AbstractEndpoint $endpoint)
{
$cloned = clone $endpoint;

$cloned->setIndex($this->getName());
if ($endpoint instanceof Create || $endpoint instanceof \Elasticsearch\Endpoints\Indices\Mapping\Put) {
$cloned->setParams(['include_type_name' => true]);
}

return $this->getClient()->requestEndpoint($cloned);
return $this->getClient()->requestEndpoint($endpoint);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/Elastica/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ public function testBulk()
$client = $this->_getClient();

$params = [
['index' => ['_index' => 'test', '_type' => '_doc', '_id' => '1']],
['index' => ['_index' => 'test', '_id' => '1']],
['user' => ['name' => 'hans']],
['index' => ['_index' => 'test', '_type' => '_doc', '_id' => '2']],
['index' => ['_index' => 'test', '_id' => '2']],
['user' => ['name' => 'peter']],
];

Expand Down

0 comments on commit 0687884

Please sign in to comment.