PHP code example of gskema / elasticsearch-query-dsl-php

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

    

gskema / elasticsearch-query-dsl-php example snippets


#[Options([
    'flags' => 'ALL|ANYSTRING|COMPLEMENT|EMPTY|INTERSECTION|INTERVAL|NONE',
    'max_determinized_states' => 2000,
    ...
])]
class RegexpMatcher implements MultiTermMatcherInterface {}

#[Parameters([
    'timeout' => '2s',
    'terminate_after' => 1,
    'max_concurrent_shard_requests' => 2,
    ...
])]
class SearchRequest implements SearchRequestInterface {}

(new SearchRequest())->setQuery(
    (new BoolQuery()->addFilter(new TermQuery('x')
)->setPostFilter(new BoolQuery(...)))
 bash
composer