PHP code example of galexth / elasticsearch-odm

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

    

galexth / elasticsearch-odm example snippets


$doc = Document::setQuery(
    (new BoolQuery())->addFilter(new Term(['field' => $field]))
        ->addFilter(new Term(['field2' => $field2]))
)->firstOrFail();

$doc->delete();
]);

$document = $query->get(['field1']);

$document = $query->first();

$document->setHidden(['field1', 'field2']);

$document->toArray();