# Replacement for setTypes(list of types) in 7.8 version - can we pass multiple indices to SearchRequest

**URL:** <https://discuss.elastic.co/t/replacement-for-settypes-list-of-types-in-7-8-version-can-we-pass-multiple-indices-to-searchrequest/247022>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 31, 2020, 10:10pm UTC](https://discuss.elastic.co/t/replacement-for-settypes-list-of-types-in-7-8-version-can-we-pass-multiple-indices-to-searchrequest/247022 "2020-08-31T22:10:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [August 31, 2020, 10:10pm UTC](https://discuss.elastic.co/t/replacement-for-settypes-list-of-types-in-7-8-version-can-we-pass-multiple-indices-to-searchrequest/247022/1 "2020-08-31T22:10:47Z")

</div>

In 5.5.2 version we had a search query as shown below which uses settypes array(basically list of types).  
SearchRequestBuilder searchBuilder = client.prepareSearch(index).setTypes((String) types.toArray(new String[types.size()])).setFrom(startIndex).setSize(size);  
In 7.8 we are planning to move to typeless. What should I replace setTypes array with. We are replacing each type with an index now. So, Should I loop the search request object inside the list of indices. Can we pass multiple indices to Searchrequest like how we pass multiple types. Please let me know how shld I proceed in this case

---

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [August 31, 2020, 11:11pm UTC](https://discuss.elastic.co/t/replacement-for-settypes-list-of-types-in-7-8-version-can-we-pass-multiple-indices-to-searchrequest/247022/2 "2020-08-31T23:11:42Z")

</div>

Ok found that SearchRequest takes multiple indices trying that right now.

---

<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:** [September 28, 2020, 11:11pm UTC](https://discuss.elastic.co/t/replacement-for-settypes-list-of-types-in-7-8-version-can-we-pass-multiple-indices-to-searchrequest/247022/3 "2020-09-28T23:11:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
