PHP code example of shyim / opensearch-php-dsl

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

    

shyim / opensearch-php-dsl example snippets




penSearchDSL\Search;
use OpenSearchDSL\Query\MatchAllQuery;

$search = new Search();
$search->addQuery(new MatchAllQuery());

$params = [
    'index' => 'your_index',
    'body'  => $search->toArray(),
];

// Use with opensearch-php client
$client = \OpenSearch\ClientBuilder::create()->build();
$results = $client->search($params);
bash
composer