我想使用 Elasticsearch PHP API 查询多个类型和索引。但我不知道怎么做。
我应该将类型和索引数组传递给$params
吗? :
$params['index'] = $index;//array of indices
$params['type'] = $types;//array of types
$params['body'] = $q;//query body
//request elasticsearch for matched documents
$results = $client->search($params);
答案 0 :(得分:10)
您只需将它们作为字符串添加到$params
:
$params['index'] = "index1, index2";//array of indices
$params['type'] = "type1, type2";//array of types
$params['body'] = $q;//query body
//request elasticsearch for matched documents
$results = $client->search($params);