Query with Nested, Location and script

Hi all,

I'm Jordan and i work on a search engine. I need some help writting a script...

This is a part of my query :

And the error is: "failed to run inline script [doc['services.distance'].value <= doc['location'].arcDistanceInKm(lat, lon)] using lang [groovy]"; "groovy_script_execution_exception";

Hi,

I have a very similar issue, if someone could help with this, it would be great.

Thanks.

Just checking, do you have scripting enabled?

I think...

It's a lot easier if you just paste the text, rather than a screenshot of that text.

However that looks correct.

I post all my query... If you see an error.

{ "query": { "bool": { "filter": [ { "nested": { "path": "stores", "query": { "bool": { "filter": [ { "match": { "stores.id": 1 } }, { "or": [ { "match": { "stores.active_distance": false } }, { "and": [ { "match": { "stores.active_distance": true } }, { "script": { "script": { "params": { "lat": 12.345678, "lon": 12.345678 }, "lang": "groovy", "inline": "doc['stores.distance'].value >= doc['location'].arcDistanceInKm(lat, lon)" } } } ] } ] } ] } } } }, { "not": { "match": { "_id": 2 } } } ] } } }