src/Command/Elasticsearch.php
public function setSettings(array $settings) {
        $this->settings = $settings;

        $hosts = \ECL\Util::get($settings, 'hosts', []);
        $index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
        $ssl_cert = \ECL\Util::get($settings, 'ssl_cert', null);
        $ssl_client_key = \ECL\Util::get($settings, 'ssl_client_key', null);
        $ssl_client_cert = \ECL\Util::get($settings, 'ssl_client_cert', null);

        if(count($index_hosts) == 0) {
            $index_hosts = $hosts;
        }

        $cb = \Elasticsearch\ClientBuilder::create();
        if(count($hosts)) {
            $cb->setHosts($hosts);
        }

        $icb = \Elasticsearch\ClientBuilder::create();
        if(count($index_hosts)) {
            $icb->setHosts($index_hosts);
        }

        if($ssl_cert !== null) {
            $cb->setSSLVerification($ssl_cert);
            $icb->setSSLVerification($ssl_cert);
        }
        if($ssl_client_key !== null && $ssl_client_cert !== null) {
            $cb->setSSLKey($ssl_client_key);
            $cb->setSSLCert($ssl_client_cert);
            $icb->setSSLKey($ssl_client_key);
            $icb->setSSLCert($ssl_client_cert);
        }

        $this->client = $cb->build();
        $this->index_client = $icb->build();
    }
public function setSettings(array $settings) {
        $this->settings = $settings;

        $hosts = \ECL\Util::get($settings, 'hosts', []);
        $index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
        $ssl_cert = \ECL\Util::get($settings, 'ssl_cert', null);
        $ssl_client_key = \ECL\Util::get($settings, 'ssl_client_key', null);
        $ssl_client_cert = \ECL\Util::get($settings, 'ssl_client_cert', null);

        if(count($index_hosts) == 0) {
            $index_hosts = $hosts;
        }

        $cb = \Elasticsearch\ClientBuilder::create();
        if(count($hosts)) {
            $cb->setHosts($hosts);
        }

        $icb = \Elasticsearch\ClientBuilder::create();
        if(count($index_hosts)) {
            $icb->setHosts($index_hosts);
        }

        if($ssl_cert !== null) {
            $cb->setSSLVerification($ssl_cert);
            $icb->setSSLVerification($ssl_cert);
        }
        if($ssl_client_key !== null && $ssl_client_cert !== null) {
            $cb->setSSLKey($ssl_client_key);
            $cb->setSSLCert($ssl_client_cert);
            $icb->setSSLKey($ssl_client_key);
            $icb->setSSLCert($ssl_client_cert);
        }

        $this->client = $cb->build();
        $this->index_client = $icb->build();
    }
public function setSettings ( array $ settings ) { $ this -> settings = $ settings ; $ hosts = \ ECL \ Util :: get ( $ settings , 'hosts' , [ ] ) ; $ index_hosts = \ ECL \ Util :: get ( $ settings , 'index_hosts' , [ ] ) ; $ ssl_cert = \ ECL \ Util :: get ( $ settings , 'ssl_cert' , null ) ; $ ssl_client_key = \ ECL \ Util :: get ( $ settings , 'ssl_client_key' , null ) ; $ ssl_client_cert = \ ECL \ Util :: get ( $ settings , 'ssl_client_cert' , null ) ; if ( count ( $ index_hosts ) == 0 ) { $ index_hosts = $ hosts ; } $ cb = \ Elasticsearch \ ClientBuilder :: create ( ) ; if ( count ( $ hosts ) ) { $ cb -> setHosts ( $ hosts ) ; } $ icb = \ Elasticsearch \ ClientBuilder :: create ( ) ; if ( count ( $ index_hosts ) ) { $ icb -> setHosts ( $ index_hosts ) ; } if ( $ ssl_cert !== null ) { $ cb -> setSSLVerification ( $ ssl_cert ) ; $ icb -> setSSLVerification ( $ ssl_cert ) ; } if ( $ ssl_client_key !== null && $ ssl_client_cert !== null ) { $ cb -> setSSLKey ( $ ssl_client_key ) ; $ cb -> setSSLCert ( $ ssl_client_cert ) ; $ icb -> setSSLKey ( $ ssl_client_key ) ; $ icb -> setSSLCert ( $ ssl_client_cert ) ; } $ this -> client = $ cb -> build ( ) ; $ this -> index_client = $ icb -> build ( ) ; }
Set the current list of settings.
@param array $settings List of settings to apply.
Set the current list of settings .