# Unknown key for a START\_OBJECT in \[facets\]?

**URL:** <https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319>\
**Category:** Elasticsearch\
**Created:** [December 16, 2016, 8:32pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319 "2016-12-16T20:32:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![west415](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@west415](https://discuss.elastic.co/u/west415)\
**Post date:** [December 16, 2016, 8:32pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319/1 "2016-12-16T20:32:45Z")

</div>

Hi,

I'm new to elasticsearch and using 5.1.1. I'm really enjoying what I'm learning and now I want to be able to build a set of facets to allow users to filter on the indexed data. I have 150 or so documents indexed. I'm trying to query them with via a REST console with the goal of being able to get an output that would allow me to display results like:

Boston (30)  
Los Angeles(14)  
Houston(22)

Here is the code and the error I'm getting below it:

```
\\my query  
{
  "query": {
  "match": {"_all": "Boston"}},
  "facets":{   
    "city": {"terms": {"field": "city"}}
   }
}

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

---

<div class="post-metadata">

**Author:** ![west415](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@west415](https://discuss.elastic.co/u/west415)\
**Post date:** [December 16, 2016, 8:43pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319/2 "2016-12-16T20:43:15Z")

</div>

It looks like I may need to be using aggregations and the code above I provided uses "facets". I'm guessing that is why I'm getting this error?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 16, 2016, 8:49pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319/3 "2016-12-16T20:49:25Z")

</div>

Yes.

---

<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 13, 2017, 8:49pm UTC](https://discuss.elastic.co/t/unknown-key-for-a-start-object-in-facets/69319/4 "2017-01-13T20:49:32Z")

</div>

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