# Search Multiple Indices using elastic low level client

**URL:** <https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683>\
**Category:** Elasticsearch\
**Created:** [March 9, 2021, 11:30am UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683 "2021-03-09T11:30:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![schawla](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@schawla](https://discuss.elastic.co/u/schawla)\
**Post date:** [March 9, 2021, 11:30am UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683/1 "2021-03-09T11:30:24Z")

</div>

I am trying to use elastic low level client to search multiple indices through -

`client.LowLevel.Search<StringResponse>(PostData.Serializable(new SearchRequest(new[] {"Index1", "Index2"}) { Size = 10, From = 0, Query = searchQuery))`

Results i am getting are across other indices as well which i have not defined in the list of indices to search.

I found a work around -

`client.LowLevel.Search<StringResponse>("Index", PostData.Serializable(new SearchRequest() { Size = 10, From = 0, Query = searchQuery))`

But this way i am not able to search multiple indices.

I also cant use the high level client since i want to return raw search response (without deserializing) which i have only been able to achieve through low level client.

---

<div class="post-metadata">

**Author:** ![schawla](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@schawla](https://discuss.elastic.co/u/schawla)\
**Post date:** [March 9, 2021, 12:59pm UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683/2 "2021-03-09T12:59:47Z")

</div>

@forloop Hi, can you please help me if there is a way to return raw json response from elastic high level client or a solution for the question above.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [March 11, 2021, 12:10pm UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683/3 "2021-03-11T12:10:36Z")

</div>

With the low level client call, the indices must be specified as the index parameter, comma separated. For example

```auto
var response = client.LowLevel.Search<StringResponse>(
    "Index1,Index2", 
    PostData.Serializable(new SearchRequest { 
        Size = 10, 
        From = 0, 
        Query = searchQuery
    }));

```

---

<div class="post-metadata">

**Author:** ![schawla](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@schawla](https://discuss.elastic.co/u/schawla)\
**Post date:** [March 18, 2021, 10:44am UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683/4 "2021-03-18T10:44:47Z")

</div>

@forloop Thanks for helping out. The above solution worked.

Had another question related to the same. Is there a way to specify indices name with wildcard ? Like i want to search all indices which end with \_qa (news\_qa, person\_qa, apps\_qa). Is there something like \*\_qa which i can specify while specifying indices to search in low level client.

---

<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:** [April 15, 2021, 10:45am UTC](https://discuss.elastic.co/t/search-multiple-indices-using-elastic-low-level-client/266683/5 "2021-04-15T10:45:32Z")

</div>

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