Geo Distance Query and OR Syntax?

I am using Elasticsearch 7.6 and trying to run a query that runs a geo_distance query to find matching documents within an exact city OR within a distance range of 25 miles in this case.

In layman's terms, it would be "Do a search for all jobs in the city of "Santa Rosa, CA" OR 25 miles around it. If there are jobs within 25 miles of Santa Rosa, CA those documents should be returned in the search results as well as any matches where the "job_location" is specifically "Santa Rosa, CA" if that makes sense.

Here is my query, which returns 0 results despite there being matching documents within 25 miles of my specified longitude and latitude which is Santa Rosa, CA.

I must have the syntax wrong.

{
  "query": {
    "bool": {
      "filter": {
        "geo_distance": {
          "distance": "25 miles",
          "geo_location": "38.440429,-122.7140548"
        }
      },
      "must": [
        {
          "match": {
            "active": true
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "job_location": "Santa Rosa, CA"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

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