diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc87bfee0..972f012137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ All notable changes to this project will be documented in this file based on the - removed analyzed/not_analyzed on [indices mapping](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/mapping-index.html) - [store](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/mapping-store.html) field only accepts boolean - Replace IndexAlreadyExistsException with [ResourceAlreadyExistsException](https://github.com/elastic/elasticsearch/pull/21494) [#1350](https://github.com/ruflin/Elastica/pull/1350) - +- in order to delete an index you should not delete by its alias now you should delete using the [concrete index name](https://github.com/elastic/elasticsearch/blob/6.0/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java#L445) [#1348](https://github.com/ruflin/Elastica/pull/1348) + ### Bugfixes - Enforce [Content-Type requirement on the layer Rest](https://github.com/elastic/elasticsearch/pull/23146), a [PR on Elastica #1301](https://github.com/ruflin/Elastica/issues/1301) solved it (it has been implemented only in the HTTP Transport), but it was not implemented in the Guzzle Transport. [#1349](https://github.com/ruflin/Elastica/pull/1349) diff --git a/test/Elastica/Index/SettingsTest.php b/test/Elastica/Index/SettingsTest.php index e461e5c0b1..be1177b76a 100644 --- a/test/Elastica/Index/SettingsTest.php +++ b/test/Elastica/Index/SettingsTest.php @@ -36,8 +36,6 @@ public function testGet() */ public function testGetWithAlias() { - $this->markTestSkipped('ES6 update: to delete an index USE the concrete index name'); - $indexName = 'elasticatest'; $aliasName = 'elasticatest_alias'; @@ -55,9 +53,39 @@ public function testGetWithAlias() $this->assertNotNull($settings->get('number_of_shards')); $this->assertNull($settings->get('kjqwerjlqwer')); + $index = $client->getIndex($indexName); $index->delete(); } + + /** + * @group functional + * + */ + public function testDeleteAliasWithException() + { + $indexName = 'deletetestaliasexception'; + $aliasName = 'deletetestaliasexception_alias'; + $client = $this->_getClient(); + $index = $client->getIndex($indexName); + $index->create([], true); + $index->refresh(); + + $index->addAlias($aliasName); + + $indexAlias = $client->getIndex($aliasName); + + try { + $indexAlias->delete(); + $this->fail('Should throw exception because you should delete the concrete index and not the alias'); + } catch (ResponseException $e) { + $error = $e->getResponse()->getFullError(); + + $this->assertContains('illegal_argument_exception', $error['type']); + $this->assertContains('specify the corresponding concrete indices instead.', $error['reason']); + } + } + /** * @group functional */ diff --git a/test/Elastica/Query/BoostingTest.php b/test/Elastica/Query/BoostingTest.php index 511b798fd8..ee18ffccf9 100644 --- a/test/Elastica/Query/BoostingTest.php +++ b/test/Elastica/Query/BoostingTest.php @@ -16,7 +16,7 @@ class BoostingTest extends BaseTest ['name' => 'Vital Match', 'price' => 2.1], ['name' => 'Mercury Vital', 'price' => 7.5], ['name' => 'Fist Mercury', 'price' => 3.8], - ['name' => 'Lama Vital 2nd', 'price' => 1.2], + ['name' => 'Lama Vital 2nd', 'price' => 3.2], ]; protected function _getTestIndex() diff --git a/test/Elastica/Query/MoreLikeThisTest.php b/test/Elastica/Query/MoreLikeThisTest.php index 8c1ac67557..c809682426 100644 --- a/test/Elastica/Query/MoreLikeThisTest.php +++ b/test/Elastica/Query/MoreLikeThisTest.php @@ -26,8 +26,8 @@ public function testSearch() $type = new Type($index, 'helloworldmlt'); $mapping = new Mapping($type, [ - 'email' => ['store' => 'true', 'type' => 'text', 'index' => 'true'], - 'content' => ['store' => 'true', 'type' => 'text', 'index' => 'true'], + 'email' => ['store' => true, 'type' => 'text', 'index' => true], + 'content' => ['store' => true, 'type' => 'text', 'index' => true], ]); $mapping->setSource(['enabled' => false]);