PHP code example of xiaosongshu / yii2-elasticsearch
1. Go to this page and download the library: Download xiaosongshu/yii2-elasticsearch 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/ */
xiaosongshu / yii2-elasticsearch example snippets
'components' => [
'ESClient' => [
'class' => \Xiaosongshu\Elasticsearch\ESClient::class,
'node'=>['192.168.101.170:9200'],
'username' => '',
'password' => '',
],
]
$res = Yii::$app->ESClient->search('index','_doc','title','测试')['hits']['hits'];