# Using multiple types or indexes in Elasticsearch php API

**URL:** <https://discuss.elastic.co/t/using-multiple-types-or-indexes-in-elasticsearch-php-api/20839>\
**Category:** Elasticsearch\
**Created:** [November 19, 2014, 4:41pm UTC](https://discuss.elastic.co/t/using-multiple-types-or-indexes-in-elasticsearch-php-api/20839 "2014-11-19T16:41:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ra\_Min](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Ra\_Min](https://discuss.elastic.co/u/Ra_Min)\
**Post date:** [November 19, 2014, 4:41pm UTC](https://discuss.elastic.co/t/using-multiple-types-or-indexes-in-elasticsearch-php-api/20839/1 "2014-11-19T16:41:32Z")

</div>

I want to query multiple types and indices using Elasticsearch PHP API. but  
I don't Know how. should I 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);

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d858eb2f-df3f-435c-ae61-05ecd35b61cb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d858eb2f-df3f-435c-ae61-05ecd35b61cb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:48am UTC](https://discuss.elastic.co/t/using-multiple-types-or-indexes-in-elasticsearch-php-api/20839/2 "2017-07-06T00:48:59Z")

</div>


