我该如何查询

http://localhost:9200/index/businesses/_search?q=services

在Cakephp3 ElasticSearch中

我努力了
$this->Businesses->find('all')->where(['*'=>'services']);

但是我没有结果。

最佳答案

更准确的答案是使用构建器

    $q = 'services';
    $businesses = $this->Businesses->find('all')->where(function ($builder) use($q) {
            return $builder->query(new \Elastica\Query\SimpleQueryString($q));
        });

_all键可以解决问题
$this->Businesses->find('all')->where(['_all'=>'services']);

10-07 17:54