# Searching when multiple indices have same field

**URL:** <https://discuss.elastic.co/t/searching-when-multiple-indices-have-same-field/154530>\
**Category:** Kibana\
**Created:** [October 29, 2018, 11:18pm UTC](https://discuss.elastic.co/t/searching-when-multiple-indices-have-same-field/154530 "2018-10-29T23:18:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiakj](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@misiakj](https://discuss.elastic.co/u/misiakj)\
**Post date:** [October 29, 2018, 11:18pm UTC](https://discuss.elastic.co/t/searching-when-multiple-indices-have-same-field/154530/1 "2018-10-29T23:18:16Z")

</div>

I have a few different indices, each of which have a different data type that they represent. Each of these data types are related.

For Example

Issue Index,  
Tag Index,  
Audit Trail Index.

Each with a single data type . (Issue, Tag, Audit Entry)

Each of these data types has a case\_id field, and a number of other fields related to that data type.

I would like to have a Dashboard where I can do something like the below.

Filter on Tag by a field that only exists in the Tag index (Tagger for example).  
Select All Case\_ID by that filter.  
Filter Issues by those case ids.

Is this possible? This would be similar to what in SQL would look like  
SELECT \* FROM issues WHERE case\_id in (SELECT case\_id FROM tags WHERE tagger = 'jon smith');

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [October 30, 2018, 4:01pm UTC](https://discuss.elastic.co/t/searching-when-multiple-indices-have-same-field/154530/2 "2018-10-30T16:01:43Z")

</div>

Hey @misiakj,

If you were to create documents similar to the following:

```auto
POST countries/_doc
{
  "country": "USA"
}

POST countries/_doc
{
  "country": "CN"
}

POST countries/_doc
{
  "country": "BZ"
}

POST municipalities/_doc
{
  "name": "California",
  "country": "USA"
}

POST municipalities/_doc
{
  "name": "Texas",
  "country": "USA"
}

POST municipalities/_doc
{
  "name": "California",
  "country": "USA"
}

POST municipalities/_doc
{
  "name": "São Paulo",
  "country": "BZ"
}

POST municipalities/_doc
{
  "name": " Brasília",
  "country": "BZ"
}

POST municipalities/_doc
{
  "name": "Shanghai",
  "country": "CN"
}

POST municipalities/_doc
{
  "name": " Beijing",
  "country": "CN"
}

```

Then you could create two index patterns, one for Countries and one for Municipalities.

Then you can create two Visualizations, one which is the "Input Control" defined like so:

 ![55%20AM](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e7d52a964aa69e49966ae9c7de9c0ab4bf7f0016.png)

 ![11%20AM](https://us1.discourse-cdn.com/elastic/original/3X/d/f/dfd7ee6cfa9af0da3e2e12c067d563d28840a439.png)

And then if you added both to a Dashboard, you could use the Input Controls visualization to filter which Municipalities are shown:

 ![47%20AM](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0f09d1b6e7dadf2daf89b3af4d6006b242ad13bf.png)

---

<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:** [November 27, 2018, 4:01pm UTC](https://discuss.elastic.co/t/searching-when-multiple-indices-have-same-field/154530/3 "2018-11-27T16:01:47Z")

</div>

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