# Unknown key for a START\_OBJECT in \[should\]

**URL:** <https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008>\
**Category:** Elasticsearch\
**Created:** [July 13, 2018, 8:03pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008 "2018-07-13T20:03:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nola111](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nola111](https://discuss.elastic.co/u/nola111)\
**Post date:** [July 13, 2018, 8:03pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/1 "2018-07-13T20:03:28Z")

</div>

Hi all,

Still brand new to ElasticSearch (and JSON for that matter). I get this error:

```auto
{
    "error": {
        "root_cause": [
            {
                "type": "parsing_exception",
                "reason": "Unknown key for a START_OBJECT in [should].",
                "line": 19,
                "col": 4
            }
        ],
        "type": "parsing_exception",
        "reason": "Unknown key for a START_OBJECT in [should].",
        "line": 19,
        "col": 4
    },
    "status": 400
}
```

When making this call to my ElasticSearch Index:

```auto
{
   "size": 150,
   "query": {
      "bool": {
         "must": {
            "nested": {
               "path": "entities",
               "query": {
                  "match": {
                     "entities.name": "donald trump"
                  }
               }
            }
         }
      }
   },

   "should":
   {
      "nested": {
         "path": "entities",
         "query": {
            "match_phrase": {
               "entities.name": {
                  "query": "donald trump",
                  "slop": 5
               }
            }
         }
      }
   },
  
   "rescore": {
      "window_size": 2000,
      "query": {
         "score_mode": "max",
         "rescore_query": {
            "nested": {
               "path": "entities",
               "score_mode": "max",
               "query": {
                  "function_score": {
                     "doc_score": {
                        "field": "entities.name",
                        "query_value": "donald trump"
                     }
                  }
               }
            }
         }
      }
   },
   "query_weight": 0,
   "rescore_query_weight": 1
}

```

Would someone be kind enough to guide me on correcting this error, as well as let me know if you see anything else in this query that I need to correct?

Many thanks!

---

<div class="post-metadata">

**Author:** ![nola111](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nola111](https://discuss.elastic.co/u/nola111)\
**Post date:** [July 14, 2018, 1:57pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/2 "2018-07-14T13:57:07Z")

</div>

Bump. If anyone can point me in the right direction I'd be very appreciative. I'm unfortunately holding up some progress on my team until I can figure this out.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 16, 2018, 1:26am UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/3 "2018-07-16T01:26:39Z")

</div>

> [@nola111](#):
>
> Bump

From the [ES forum about post](https://discuss.elastic.co/t/about-the-elasticsearch-category/21):

> Please see the code of conduct 171 for more details on our code of conduct (in particular the "be patient" section).

Bumping your own post after 1 day (over a weekend!) suggests that you have unrealistic expectations about the level of support we are able to provide in these forums.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 16, 2018, 1:33am UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/4 "2018-07-16T01:33:22Z")

</div>

> [@nola111](#):
>
> "Unknown key for a START\_OBJECT in [should]."

This error is saying (somewhat cryptically) that you have a key `"should"` with an Object value, in place where that key isn't recognised.

The specific cause here is that your "should" needs to be part of your ["bool" query](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/query-dsl-bool-query.html), not part of the `_search` body.

---

<div class="post-metadata">

**Author:** ![nola111](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nola111](https://discuss.elastic.co/u/nola111)\
**Post date:** [July 16, 2018, 3:53pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/5 "2018-07-16T15:53:45Z")

</div>

Hi Tim, sorry about that and understood. I'm new here, but not new to forums so I can't claim total ignorance on the subject. Thanks for the heads-up.

---

<div class="post-metadata">

**Author:** ![nola111](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nola111](https://discuss.elastic.co/u/nola111)\
**Post date:** [July 16, 2018, 4:20pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/6 "2018-07-16T16:20:03Z")

</div>

Thanks for the reply, Tim. I can see now how the Should is outside of the bool. Thanks so much!!

---

<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:** [August 13, 2018, 4:20pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-should/140008/7 "2018-08-13T16:20:03Z")

</div>

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