[ 'bool' => [ 'should' => [ [ 'match' => [ 'content' => [ 'query' => $keywords, 'boost' => 4, ] ] ], // [ // 'match' => [ // 'abs' => [ // 'query' => $keywords, // 'boost' => 3, // ] // ] // ] ], ], ], 'from' => $from, 'size' => $size ]; $res = $obj->search_doc('weibo', 'doc', $body); $hits = $res['hits']['hits']; if(empty($hits)){ $data['info'] = '数据为空'; echo json_encode($data, true); exit; } $rdata = []; foreach($hits as $val) { $rdata[] = $val['_source']; } $data['status'] = true; $data['data'] = $rdata; echo json_encode($data, true); exit;