Installationedit

  • Include elasticsearch-php in your composer.json file:

    {
        "require": {
            "elasticsearch/elasticsearch": "~6.7.0"
        }
    }
  • Install the client with composer:

    curl -s http://getcomposer.org/installer | php
    php composer.phar install --no-dev
  • Include the autoloader in your main project (if you haven’t already), and instantiate a new client :

    require 'vendor/autoload.php';
    
    use Elasticsearch\ClientBuilder;
    
    $client = ClientBuilder::create()->build();