“[geo_distance] malformed query, expected [END_OBJECT] but found [FIELD_NAME]”

I am tried to create search queary with a values in 15m radios and between 3 weeks. I tried to execute this query:

   >  "query": {
> "bool": {
>   "must": {
>     "match_all": {}
>   }
> , "filter": [
>   {
>     "geo_distance": {
>      
>       "distance": "1000km",
>       "geoLocation": {
>         "lat": 31.966467334184614,
>         "lon": 35.83242623178664
>       }
>     }
>     ,
>    "range": {
>       "map_date": {
>         "gte": "now-3w/w",
>         "lte": "now/w"
>       }
>     }
>     
>   }
> ]
> }}

my date filed is : map_date and my geo point filed is geoLocation I get this response :

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "[geo_distance] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
        "line" : 18,
        "col" : 8
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[18:8] [bool] failed to parse field [filter]",
    "caused_by" : {
      "type" : "parsing_exception",
      "reason" : "[geo_distance] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
      "line" : 18,
      "col" : 8
    }
  },
  "status" : 400
}

help me plz to figure out what I am doing wrong :roll_eyes:

I get answer in stack: https://stackoverflow.com/questions/65595936/geo-distance-malformed-query-expected-end-object-but-found-field-name

1 Like

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