# App search filters not working

**URL:** <https://discuss.elastic.co/t/app-search-filters-not-working/336697>\
**Category:** Elasticsearch\
**Created:** [June 22, 2023, 1:12pm UTC](https://discuss.elastic.co/t/app-search-filters-not-working/336697 "2023-06-22T13:12:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teoman\_kirac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/teoman_kirac/32/117152_2.png) [@teoman\_kirac](https://discuss.elastic.co/u/teoman_kirac)\
**Post date:** [June 22, 2023, 1:12pm UTC](https://discuss.elastic.co/t/app-search-filters-not-working/336697/1 "2023-06-22T13:12:57Z")

</div>

Hi All! And thanks in advance for helping me troubleshoot 🙂

I am using app search with a gcp firestore search extension. ANd it automagically cruds according to my collection, but I can't search with a geo\_distance filter. WIth just a string query it returns the correct data.

Here is my code:

```auto
elasticClientSearch.app.search({
engine_name: "swapperooni-search-engine-latest",
query: req.query['q'],
filters: {
geo_distance: {
distance: `${req.query['distance']}km` ,
location: {
lat: req.query['lat'],
lon: req.query['lon']
}
}
// filters: {
// // all: [
// location: {
// center: [`${req.query['lat']}` , `${req.query['lon']}` ],
// unit: 'km',
// from: 0,
// to: `${req.query['distance']}`
// }
// // ]
}
})

```

Tried both of the above. Returns errors like:

**elasticsearch Client error {"errors":["Filters contains invalid keys for field: geo\_distance; keys: distance and location","Filters must specify 'from' and/or 'to' in a range filter for field: geo\_distance"]}**

he api logs show:

> Request details  
> Method  
> POST  
> Status  
> 400  
> Timestamp  
> 2023-06-21T19:10:00Z  
> User agent  
> elastic-transport-js/8.3.1 (linux 6.3.7-100.fc37.x86\_64-x64; Node.js v16.16.0)  
> Request path  
> /api/as/v1/engines/swapperooni-search-engine-latest/search?query=aaaaaaa&filters%5Bgeo\_distance%5D%5Bdistance%5D=5km&filters%5Bgeo\_distance%5D%5Blocation%5D%5Blat%5D=47.6062095&filters%5Bgeo\_distance%5D%5Blocation%5D%5Blon%5D=-122.3320708  
> Request body  
> Response body  
> {  
> "errors": [  
> "Filters contains invalid keys for field: geo\_distance; keys: distance and location",  
> "Filters must specify 'from' and/or 'to' in a range filter for field: geo\_distance"  
> ]  
> }

which makes me think for some reason the query isn't getting parsed or something?

Mappings are as follows:

> "location": {  
> "type": "text",  
> "fields": {  
> "date": {  
> "type": "date",  
> "format": "strict\_date\_time||strict\_date",  
> "ignore\_malformed": true  
> },  
> "delimiter": {  
> "type": "text",  
> "index\_options": "freqs",  
> "analyzer": "iq\_text\_delimiter"  
> },  
> "enum": {  
> "type": "keyword",  
> "ignore\_above": 2048  
> },  
> "float": {  
> "type": "double",  
> "ignore\_malformed": true  
> },  
> "joined": {  
> "type": "text",  
> "index\_options": "freqs",  
> "analyzer": "i\_text\_bigram",  
> "search\_analyzer": "q\_text\_bigram"  
> },  
> "location": {  
> "type": "geo\_point",  
> "ignore\_malformed": true,  
> "ignore\_z\_value": false  
> },  
> "prefix": {  
> "type": "text",  
> "index\_options": "docs",  
> "analyzer": "i\_prefix",  
> "search\_analyzer": "q\_prefix"  
> },  
> "stem": {  
> "type": "text",  
> "analyzer": "iq\_text\_stem"  
> }  
> },  
> "index\_options": "freqs",  
> "analyzer": "iq\_text\_base"  
> },

Any advice on how to get this to work is greatly appreciate. have tried a lot of variation, makes me think there is an issue with the gcp firestore search extentions...

---

<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:** [July 20, 2023, 1:13pm UTC](https://discuss.elastic.co/t/app-search-filters-not-working/336697/2 "2023-07-20T13:13:18Z")

</div>

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