PHP code example of mehdi89 / elasticquent

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

    

mehdi89 / elasticquent example snippets


$jsonQuery = '{
  "query": {
    "bool": {
      "must": [
        { "match": { "transcription":"'.$keyword.'" }},
        { "match": { "userID": '.$userid.' }}
      ]
    }
  }
}';
$audios = Audio::searchByQuery($jsonQuery);