# Multiple Indices Search: Failed to find nested object under path

**URL:** <https://discuss.elastic.co/t/multiple-indices-search-failed-to-find-nested-object-under-path/209753>\
**Category:** Elasticsearch\
**Created:** [November 27, 2019, 7:52pm UTC](https://discuss.elastic.co/t/multiple-indices-search-failed-to-find-nested-object-under-path/209753 "2019-11-27T19:52:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abshek](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@abshek](https://discuss.elastic.co/u/abshek)\
**Post date:** [November 27, 2019, 7:52pm UTC](https://discuss.elastic.co/t/multiple-indices-search-failed-to-find-nested-object-under-path/209753/1 "2019-11-27T19:52:50Z")

</div>

Hi  
I need to run a search query across multiple indices (say, `idx-users` and `idx-meta`). The mapping for each is different.  
`idx-users` has a nested field (path: `staysAt`, field: `staysAt.street`), while `idx-meta` doesn't have this field.  
I'm trying to do a simple search (`/idx-users,idx-meta/_search`), with `function_score` query, in which one of the `functions` is:

```auto
{
          "filter": {
            "nested": {
              "path": "staysAt",
              "query": {
                "term": {
                  "staysAt.street": "MGRoad"
                }
              }
            }
          },
          "weight": 1.5
}

```

Upon running this query, I'm facing the following error:

```auto
{
              "index": "idx-meta",
              "caused_by": {
                "type": "illegal_state_exception",
                "reason": "[nested] failed to find nested object under path [staysAt]"
              }
}

```

How can I successfully run my query, and have scores according to whichever filter functions match?

Elasticsearch: v7.0.0

---

<div class="post-metadata">

**Author:** ![Jay\_Jayswal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jay_jayswal/32/58468_2.png) [@Jay\_Jayswal](https://discuss.elastic.co/u/Jay_Jayswal)\
**Post date:** [November 28, 2019, 7:09am UTC](https://discuss.elastic.co/t/multiple-indices-search-failed-to-find-nested-object-under-path/209753/2 "2019-11-28T07:09:13Z")

</div>

I think what you are looking for is "ignore\_unmapped" parameter.  
**ignore\_unmapped:**  
Indicates whether to ignore an unmapped `path` and not return any documents instead of an error. Defaults to `false` .  
If `false` , Elasticsearch returns an error if the `path` is an unmapped field.  
You can use this parameter to query multiple indices that may not contain the field `path` .

Check the Doc: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html)

---

<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:** [December 26, 2019, 7:09am UTC](https://discuss.elastic.co/t/multiple-indices-search-failed-to-find-nested-object-under-path/209753/3 "2019-12-26T07:09:14Z")

</div>

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