PHP code example of olvlvl / elasticsearch-dsl

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

    

olvlvl / elasticsearch-dsl example snippets




use olvlvl\ElasticsearchDSL\Query;

$query = new Query;
$query->bool->must
    ->match('title', "Search")
    ->match('content', "Elasticsearch");
$query->bool->filter
    ->term('status', 'published')
    ->range('publish_date', function (Query\Term\RangeQuery $range) {
    	$range->gte("2015-01-01");
    });