# An unexpected error occurred: \[400\] Filters is missing keys for field

**URL:** <https://discuss.elastic.co/t/an-unexpected-error-occurred-400-filters-is-missing-keys-for-field/249930>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [September 25, 2020, 8:30am UTC](https://discuss.elastic.co/t/an-unexpected-error-occurred-400-filters-is-missing-keys-for-field/249930 "2020-09-25T08:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhonore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jhonore/32/76207_2.png) [@jhonore](https://discuss.elastic.co/u/jhonore)\
**Post date:** [September 25, 2020, 8:30am UTC](https://discuss.elastic.co/t/an-unexpected-error-occurred-400-filters-is-missing-keys-for-field/249930/1 "2020-09-25T08:30:26Z")

</div>

Hi,

I am no front end developer but working with the searh UI templete generate form reference UI in app serach. I want to add a geolocation facet, and I think I have managed to add the facet to the searchQuery by ediding `buildFacetConfigFromConfig()` from config-helpers.

```auto
    export function buildFacetConfigFromConfig() {

         const facets = {location: [{"type": "range", "center": "59.911491,-10.757933","unit": "m", "ranges": [{ "from": 0, "to": 100000, "name": "Nearby" }, { "from": 100000, "to": 300000, "name": "A longer drive." }, { "from": 300000, "name": "Perhaps fly?" }]}], type: [{ type: "value", size: 30 }]}

      return facets;

    } 

```

Further I have generated my own Facets (deleted the getFacetFields() from the autogenerated origin) and added them to sidecontent.

```auto

                         <Facet 

                           field = "type"

                            label = "type"

                            filtertype = "all"

                            filtertype = "any"

                            isFilterable = {true}

                            //view={BooleanFacet}

                          />

                          <Facet 

                            field = "location"

                            label = "location"

                            //center = "59.911491,-10.757933"

                            //unit = "m"   
                            />,

```

The result looks correct so far:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/e/de95125278977ef1f81f0dfcc5c8bc5edca28245.png)

using the `type` filter works fine. But when i try to apply one of the `location` options i get the following error:

`An unexpected error occurred: [400] Filters is missing keys for field: location; keys: unit and center`

Do I also need to update a Filter somewhere or what is the connection between facets and filters here?

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [October 20, 2020, 3:54pm UTC](https://discuss.elastic.co/t/an-unexpected-error-occurred-400-filters-is-missing-keys-for-field/249930/2 "2020-10-20T15:54:52Z")

</div>

It is most likely something in your filter configuration.

Can you inspect the outbound API request in your browser's network tab, and post the filters you are sending here?

---

<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:** [November 17, 2020, 3:55pm UTC](https://discuss.elastic.co/t/an-unexpected-error-occurred-400-filters-is-missing-keys-for-field/249930/3 "2020-11-17T15:55:14Z")

</div>

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