public function getTopicList($query,$size=1000,$page=0,$field=null,$IS_RANDOM){$params = ['size' => $size,'index' => 'mokao_bank_2','type' => 'mokao_bank_2','body' => ['query' => $query]];//查询条件query如下//$query = [// 'bool' => [// 'must' => [// ['match' => [ 'subject_category_id' => $subject ]],// ['match' => [ 'subject_type_id' => $topicType ]],// ['match' => [ 'is_hid' => 0 ]],// ['match' => [ 'is_del' => 0 ]],// ]// ]//];if($field){$params['_source'] = $field;}if($page > 0){$from = ($page - 1) * $size;$params['from'] = $from;}$params['body']['sort']=['_id' => ['order' => 'asc']];//抽样查询时排序替换为如下条件if($IS_RANDOM){$params['body']['sort'] = ['_script' => ['script' => 'Math.random()','type' => 'number','order' => 'asc']];}$return = $this->client->search($params);return $return['hits']['hits'];}