# How to fetch multiple return values by performing queries on multiple indices

**URL:** <https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716>\
**Category:** Elasticsearch\
**Created:** [December 28, 2020, 9:32am UTC](https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716 "2020-12-28T09:32:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharpshooter](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@sharpshooter](https://discuss.elastic.co/u/sharpshooter)\
**Post date:** [December 28, 2020, 9:32am UTC](https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716/1 "2020-12-28T09:32:13Z")

</div>

Hii i am searching on multiple indices at a time on objects like Mail , Calender , Attachment and want return values of multiple types e.g :- (Mail , Calender , Attachment) but i am not able to get it please help. Thank you

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 28, 2020, 10:37am UTC](https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716/2 "2020-12-28T10:37:35Z")

</div>

There is not a lot of information here that will allow someone to help you. Please provide a more detailed description of what you are doing as well as a full reproduction script (data, mappings and queries) that can be run from the Kibana dev console.

---

<div class="post-metadata">

**Author:** ![sharpshooter](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@sharpshooter](https://discuss.elastic.co/u/sharpshooter)\
**Post date:** [December 29, 2020, 4:31am UTC](https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716/3 "2020-12-29T04:31:43Z")

</div>

I have 2 classes  
1.Student 2.Teacher  
Student class defination is  
public class Student  
{

```
  public long StudId { get; set; } 

  public string FirstName { get; set; }

  public string LastName { get; set; }

  public string Address { get; set; }

}

```

and Teacher class defination is  
public class Teacher  
{

```
    public long TeacherID { get; set; }

    public string FirstName { get; set; }

    public string Subject{ get; set; }

    public string Address { get; set; }

}

```

Student's data is stored in "student" index and Teacher's data is stored in "teacher" index. We are using NEST in c# and our search query looks like this

var searchResponse = elasticClient.Search(search =\> search  
.Index(new { "student","teacher"})  
.Size(searchRequest.pageSize)  
.From(searchRequest.index)  
.Query(query =\> query  
.MultiMatch(c =\> c  
.Fields(f =\> f.Field(searchFilter.field))  
.Query(searchFilter.value))));

in the searchResponse currently we are receiving Teacher's object but we need both Student and Teacher object how do we do that?? please help. Thank you.

---

<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:** [January 26, 2021, 4:31am UTC](https://discuss.elastic.co/t/how-to-fetch-multiple-return-values-by-performing-queries-on-multiple-indices/259716/4 "2021-01-26T04:31:43Z")

</div>

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