Skip to content

Commit

Permalink
Use correct Put class for updating settings. Fixes #1295 (#1296)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickygerritsen authored and ruflin committed May 5, 2017
1 parent e69243a commit 4b5781f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file based on the

### Bugfixes

- Fix updating settings of an index. [#1296](https://github.com/ruflin/Elastica/pull/1296)

### Added
- Parameter `filter_path` for response filtering (e.g. `$index->search($query, ['filter_path' => 'hits.hits._source'])`)
### Improvements
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Elastica\Index\Stats as IndexStats;
use Elastica\ResultSet\BuilderInterface;
use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Endpoints\Cluster\Settings\Put;
use Elasticsearch\Endpoints\Indices\Settings\Put;
use Elasticsearch\Endpoints\DeleteByQuery;
use Elasticsearch\Endpoints\Indices\Aliases\Update;
use Elasticsearch\Endpoints\Indices\Analyze;
Expand Down
34 changes: 34 additions & 0 deletions test/Elastica/Index/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,38 @@ public function testNotFoundIndex()
$this->assertContains('index_not_found_exception', $error['type']);
}
}

/**
* @group functional
*/
public function testSetMultiple()
{
$indexName = 'test';

$client = $this->_getClient();
$index = $client->getIndex($indexName);
$index->create([], true);

$settings = $index->getSettings();

$index->setSettings([
'number_of_replicas' => 2,
'refresh_interval' => '2s',
]);

$index->refresh();
$this->assertEquals(2, $settings->get('number_of_replicas'));
$this->assertEquals('2s', $settings->get('refresh_interval'));

$index->setSettings([
'number_of_replicas' => 5,
'refresh_interval' => '5s',
]);

$index->refresh();
$this->assertEquals(5, $settings->get('number_of_replicas'));
$this->assertEquals('5s', $settings->get('refresh_interval'));

$index->delete();
}
}

0 comments on commit 4b5781f

Please sign in to comment.