ES:结果过滤失败

时间:2018-06-08 09:21:58

标签: php laravel elasticsearch

我有一个搜索查询,我想在相关参数进入时进行一些过滤。

目前的问题是,虽然我尝试了各种选项,但我没有得到任何结果,例如 let imgManager = PHImageManager.default() let requestOptions = PHImageManager() requestOptions.synchronous = true //error:Value of type 'PHImageManager' has no member 'synchronous' requestOptions.deliveryMode = .highQualityFormat // error:Value of type 'PHImageManager' has no member 'deliveryMode' matchterm

match

映射如下所示:

$records = $this->record->search()->querystring('*'.$searchTerm.'*', [
                'fields' => [
                    'original_title^4',
                    'contributors.name',
                    'customTitles.custom_title',
                ],
            ])->aggregate(function (AggregationBuilder $builder) {
                $builder->terms('group_by_type', 'type');
            });

            if (isset($filters['recordType'])) {

                $records = $records->term('recordType.type', 'movie');
            }
            $records = $records->size(500)->get()->hits();

/** * Maps the Eloquent model to ElasticSearch * @return array */ public function buildDocument() { return [ 'id' => $this->id, 'record_type_id' => $this->record_type_id, 'original_name' => $this->original_name, 'first_release_year' => $this->first_release_year, 'created_at' => $this->getElasticCreatedAt(), 'updated_at' => $this->getElasticUpdatedAt(), 'recordType' => $this->recordType, ]; } 中的recordType关系定义如下:

Record

我非常感谢任何想法

更新 没有过滤器的响应如下所示:

/**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function recordType()
    {
        return $this->belongsTo(RecordType::class, 'record_type_id');
    }

0 个答案:

没有答案