简体   繁体   English

用于searchly.com的Elasticsearch PHP连接设置

[英]Elasticsearch PHP connection settings for searchly.com

I have difficulties connecting to searchly.com with elasticsearch-php ( http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/ ) 我在使用elasticsearch-php( http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/ )连接到searchly.com时遇到困难

$params = array();
    $params['hosts'] = array (
        'https://site:{my-key}@balin-eu-west-1.searchly.com:80'
    );

    $client = new Client($params);

    $em = $this->getContainer()->get('doctrine')->getManager();
    $movies = $em->getRepository("CineupsWebAppBundle:Movie")
        ->getTitlesWithSlug();

    $params = array('index' => 'movies');
    foreach($movies as $movie)
    {
        $params['body'][] = array(
            'title' => $movie['title'],
            'titleDe' => $movie['titleDe'],
            'slugDe' => $movie['slugDe']
        );break;
    }

    $responses = $client->bulk($params);

with port 80 I get: 通过端口80我得到:

  [Elasticsearch\Common\Exceptions\TransportException]                 
  error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

without: 无:

  [Elasticsearch\Common\Exceptions\Curl\CouldNotConnectToHost]                       
  Failed to connect to balin-eu-west-1.searchly.com port 9200: Connection timed out

tried connection with curl (put new index) 尝试使用curl连接(输入新索引)

curl -XPUT http://site:{my-key}@balin-eu-west-1.searchly.com/articles

it works 有用

It seems that I miss some settings for connection, but no idea what :( 似乎我错过了一些用于连接的设置,但不知道是什么:(

Try like: 试试:

$params['hosts'] = array (
    'http://balin-eu-west-1.searchly.com:80'
);
$params['connectionParams']['auth'] = array(
    'site',
    'key',
    'Basic' 
);
$client = new Elasticsearch\Client($params);

Also please see https://github.com/searchly/searchly-php-sample 另请参阅https://github.com/searchly/searchly-php-sample

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP COM端口与DIO的连接 - PHP COM port connection with DIO PHP - 指定端口设置的 MySQL 连接 - PHP - MySQL connection for specified port settings 将php-sql连接失败缩小到服务器设置? - Narrow down php-sql connection failure to server settings? 使用PHP中的freetds时的SQL Server连接设置 - SQL Server connection settings when using freetds from PHP Elasticsearch〜2.0 PHP-无法建立连接-array到字符串的转换错误 - Elasticsearch ~2.0 php - cannot establish connection -array to string conversion error 如何解决:PHP中无法通过主机smtp.gmail.com建立连接[连接超时#110]错误 - How to resolve: Connection could not be established with host smtp.gmail.com [Connection timed out #110] error in PHP Php Laravel 5.1-无法与主机smtp.gmail.com建立连接[连接被拒绝#111] - Php Laravel 5.1- Connection could not be established with host smtp.gmail.com [Connection refused #111] ElasticSearch / ElasticCloud-连接被拒绝 - ElasticSearch/ElasticCloud - Connection refused laravel 5.2的数据库连接设置 - Database connection settings with laravel 5.2 与www.googleapis.com:443 PHP google anaytlics api相关的未知SSL协议错误 - Unknown SSL protocol error in connection to www.googleapis.com:443 PHP google anaytlics api
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM