Using multiple types or indexes in the Elasticsearch php API

I want to request several types and indexes using the Elasticearch PHP API . but I don’t know how to do it. should pass an array of types and indices to $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); 
+7
types api php search elasticsearch
source share
1 answer

You just add them as a string in $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); 
+9
source share

All Articles