Unknown key for a START_OBJECT in [facets]?


#1

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
    }

#2

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?


(David Pilato) #3

Yes.


(system) #4

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