diff --git a/composer.json b/composer.json index 87c5145838..56c00e8229 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "doctrine/dbal": "^2.4.0", "doctrine/migrations": "^1.0.0", "doctrine/orm": "^2.4.0", - "elasticsearch/elasticsearch": "~1.0", + "elasticsearch/elasticsearch": "~2.0", "facebook/php-sdk": "~3.0", "firebase/php-jwt": "^3.0.0", "gedmo/doctrine-extensions": "~2.3.0", diff --git a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php index d78e5f6dca..8826f5055c 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php @@ -29,7 +29,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContextFactory; use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryCompiler; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus; -use Elasticsearch\Client; +use Elasticsearch\ClientBuilder; use Hoa\Compiler; use Hoa\File; use Monolog\Handler\ErrorLogHandler; @@ -153,7 +153,13 @@ class SearchEngineServiceProvider implements ServiceProviderInterface $clientParams['logging'] = true; } - return new Client($clientParams); + $clientBuilder = ClientBuilder::create() + ->setHosts($clientParams['hosts']); + if(array_key_exists('logObject', $clientParams)) { + $clientBuilder->setLogger($clientParams['logObject']); + } + + return $clientBuilder->build(); }); $app['elasticsearch.options'] = $app->share(function($app) { diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping.php index aad818cc95..90558d315a 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Mapping.php @@ -106,7 +106,7 @@ class Mapping unset($field['index_analyzer'], $field['search_analyzer']); break; case 'indexing': - $field['index_analyzer'] = $analyzer; + $field['analyzer'] = $analyzer; break; case 'searching': $field['search_analyzer'] = $analyzer;