Geo context not working with completion suggester with precision in "mi"

I'm using ES v.7.6 and am trying to setup an autocomplete to search for businesses and filter out those which lie a variable distance away from the center of the search area.

When specifying precision on the query in terms of an integer, I receive valid results. However, whenever I switch my precision to a unit of distance (i.e. "30mi"), I always receive an empty result set. Any suggestions on what I am missing on my mapping or query? See below for simplified code and results that I am seeing.

Index Mapping

{
  "mappings" : {
    "properties" : {
      "name_suggest": {
        "type": "completion",
        "contexts": [
          {
            "name": "location",
            "type": "geo",
            "path": "coordinates"
          }
        ]
      },
      "coordinates" : {
        "type": "geo_point"
      },
      "name" : {
        "type" : "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}

Document Indexed

PUT /business/_doc/1
{
  "name_suggest": ["Aloha", "Aloha Paddle", "Aloha Paddle Sports"],
  "name": "Aloha Paddle Sports",
  "coordinates": {
    "lat": 35.453676,
    "lon": -80.893276
  }
}

Bool Query with Geo Distance Filter

{
  "query": {
    "bool": {
      "must": {
        "match": {
          "name": {
            "query": "Aloha"
          }
        }
      },
      "filter": [
        {
          "geo_distance": {
            "distance": "50mi",
            "coordinates": {
              "lat": 35.124,
              "lon": -80.8648
            }
          }
        }
      ]
    }
  }
}

Bool Query Results

  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.2876821,
    "hits" : [
      {
        "_index" : "business",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.2876821,
        "_source" : {
          "name_suggest" : [
            "Aloha",
            "Aloha Paddle",
            "Aloha Paddle Sports"
          ],
          "name" : "Aloha Paddle Sports",
          "coordinates" : {
            "lat" : 35.453676,
            "lon" : -80.893276
          }
        }
      }
    ]
  }
}

Completion Suggester with Geo Context Query

{
  "suggest" : {
    "suggestions" : {
      "prefix" : "Aloha P",
      "completion" : {
        "field" : "name_suggest",
        "size": 10,
        "contexts": {
          "location": [
              {
                "lat":35.124,
                "lon": -80.8648,
                "precision": "50mi"
              }
          ]
        }
      }
    }
  }
}

Completion Suggester with GeoContext Results

  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "suggestions" : [
      {
        "text" : "Aloha P",
        "offset" : 0,
        "length" : 7,
        "options" : [ ]
      }
    ]
  }
}

Completion Suggester results when Changing 'precision' to 2

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "suggestions" : [
      {
        "text" : "Aloha P",
        "offset" : 0,
        "length" : 7,
        "options" : [
          {
            "text" : "Aloha Paddle",
            "_index" : "business",
            "_type" : "_doc",
            "_id" : "1",
            "_score" : 1.0,
            "_source" : {
              "name_suggest" : [
                "Aloha",
                "Aloha Paddle",
                "Aloha Paddle Sports"
              ],
              "name" : "Aloha Paddle Sports",
              "coordinates" : {
                "lat" : 35.453676,
                "lon" : -80.893276
              }
            },
            "contexts" : {
              "location" : [
                "dnq3xn"
              ]
            }
          }
        ]
      }
    ]
  }
}

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