1. Go to this page and download the library: Download nervetattoo/elasticsearch library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nervetattoo / elasticsearch example snippets
use \ElasticSearch\Client;
// The recommended way to go about things is to use an environment variable called ELASTICSEARCH_URL
$es = Client::connection();
// Alternatively you can use dsn string
$es = Client::connection('http://127.0.0.1:9200/myindex/mytype');
$es->index(array('title' => 'My cool document'), $id);
$es->get($id);
$es->search('title:cool');