# Search multiple indexes and nested

**URL:** <https://discuss.elastic.co/t/search-multiple-indexes-and-nested/246735>\
**Category:** Elasticsearch\
**Created:** [August 28, 2020, 9:51am UTC](https://discuss.elastic.co/t/search-multiple-indexes-and-nested/246735 "2020-08-28T09:51:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chomenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chomenko/32/74686_2.png) [@chomenko](https://discuss.elastic.co/u/chomenko)\
**Post date:** [August 28, 2020, 9:51am UTC](https://discuss.elastic.co/t/search-multiple-indexes-and-nested/246735/1 "2020-08-28T09:51:43Z")

</div>

Is possible to nested query add name index when searching across multiple indexes ?

I have this question:

```auto
query: {
	bool: {
		should: [
			{
				filter: {
					term: {
						_index: "index1"
					}
				},
				bool: {
					must: {
						//...
					}
				},
			},
			{
				bool: {
					filter: {
						term: {
							_index: "index2"
						}
					},
					must: {
						nested: {
							path: "nest",
							query: {
								bool: {
									must: [
										{
											term: {
												'nest.field': '....'
											}
										}
									]
								}
							}
						}
					}
				}
			}
		]
	}
 }

```

---

<div class="post-metadata">

**Author:** ![chomenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chomenko/32/74686_2.png) [@chomenko](https://discuss.elastic.co/u/chomenko)\
**Post date:** [August 28, 2020, 10:36am UTC](https://discuss.elastic.co/t/search-multiple-indexes-and-nested/246735/2 "2020-08-28T10:36:21Z")

</div>

I found it [here](https://discuss.elastic.co/t/best-way-to-query-nested-objects-in-indexes-where-they-dont-exist/157923/2)

When searching for multiple indexes. It needs to be added to the nested `ignore_unmapped: true`

```auto
nested: {
	path: "nest",
	ignore_unmapped: true,
	query: {
		bool: {
			must: [
				//....
			]
		}
	}
}

```

---

<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 25, 2020, 10:36am UTC](https://discuss.elastic.co/t/search-multiple-indexes-and-nested/246735/3 "2020-09-25T10:36:27Z")

</div>

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