PHP code example of yd / log_es

1. Go to this page and download the library: Download yd/log_es 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/ */

    

yd / log_es example snippets


$logkey = 'log_only_for_test';

$where  = ['_id' => 'AWX7gJtQKEvuT5mLCgIQ'];
$result = EsClient::instance($logkey)->get($where);
var_dump($result); 

$sorts  = ["create_at" => "asc"];
$where  = ['name' => 'name_17'];
$result = EsClient::instance($logkey)->getsAll($where, $sorts);
var_dump($result);

$sorts  = ["create_at" => "desc"];
$where  = ['name' => 'name_17', "create_at" => ["gte" => "2018-09-21 16:49:06", "lte" => "2018-09-21 17:41:14"]];
$result = EsClient::instance($logkey)->getsPage($where, 1, 100, $sorts);
var_dump($result);

$where  = ['name' => 'name_17'];
$result = EsClient::instance($logkey)->count($where);
var_dump($result);