在Elasticsearch中转换laravel搜索查询的问题

时间:2019-08-28 12:22:23

标签: php laravel elasticsearch

我在laravel项目中有搜索表单,该表单使用带有laravel雄辩查询的搜索。我正在尝试使用elasticsearch构建更高级的搜索,但是我对此并不陌生,需要帮助将该查询转换为elasticsearch查询。我正在使用与作曲家一起安装的“ elasticsearch / elasticsearch”:“ ^ 7.2”。任何帮助表示赞赏。这是我的查询。

$query = Property::query();

if (Request::has('propertyType')) {
    Request::get('propertyType');
}

$propertyType = Request::input('propertyType');

if (!empty($propertyType)) {
    $query->whereHas('category', function ($query) use ($propertyType) {
        $query->whereIn('category', $propertyType);
    });
}

$results = $query->paginate(6, ['*'], 'searchResults');

0 个答案:

没有答案