1. Go to this page and download the library: Download gemini/elastic-bool-query 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/ */
gemini / elastic-bool-query example snippets
declare(strict_types=1);
namespace App\Query;
use Fan\ElasticBoolQuery\Document;
class Foo extends Document
{
public function getIndex(): string
{
return 'foo';
}
public function getMapping(): array
{
return [
'id' => ['type' => 'long'],
'name' => ['type' => 'keyword'],
'summary' => ['type' => 'text'],
];
}
}
declare(strict_types=1);
use Fan\ElasticBoolQuery\Config;
use Fan\ElasticBoolQuery\Document;
class Foo extends Document
{
public function getIndex(): string
{
return 'foo';
}
}
shell
php bin/hyperf.php gen:elastic model -I foo -M App\\Query\\Foo
shell
php bin/hyperf.php gen:elastic index -M App\\Query\\Foo