easyswoole结合Elasticsearch实现站内搜索

use Elasticsearch\ClientBuilder;

function search(){
$Client=ClientBuilder::create()->setHosts([
“127.0.0.1:9200”
])->build();
$param=[
‘index’=>’shop’,
‘type’=>’googd’,
‘body’=>[
‘query’=>[
‘match’=>[
‘name’=>’car3’
]
],
‘size’=>3
]
];

$res=$Client->search($param);
var_dump($res);
$this->writeJson($res);
}

This entry was posted in 编程 by .

发表评论

电子邮件地址不会被公开。 必填项已用*标注