# Geo Context with Completion Suggester

**URL:** <https://discuss.elastic.co/t/geo-context-with-completion-suggester/231149>\
**Category:** Elasticsearch\
**Created:** [May 5, 2020, 12:39pm UTC](https://discuss.elastic.co/t/geo-context-with-completion-suggester/231149 "2020-05-05T12:39:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Douglas\_Leister](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/douglas_leister/32/50610_2.png) [@Douglas\_Leister](https://discuss.elastic.co/u/Douglas_Leister)\
**Post date:** [May 5, 2020, 12:39pm UTC](https://discuss.elastic.co/t/geo-context-with-completion-suggester/231149/1 "2020-05-05T12:39:07Z")

</div>

New to Es. So apologies if I am missing something simple. I am working on a suggester which should return business names. I'd like to use a geocontext to return names that fall within a given distance ("30mi") from a user's location. From reading the docs, my understanding is that I enter the search range ("30mi") as the precision for the context I provide with the suggest. When I enter precision as a string based distance, I receive an empty or incomplete result set that misses results within the 30 mile radius. When I entered as a an integer, it works as expected. Any suggestions on what I am doing wrong? Should I be entering the 30 mile distance under neighbours? The docs weren't completely clear on difference between neighbours and precision in filtering results.

**Mapping**

```auto
PUT /provider/
{
    "mappings" : {
      "properties" : {
        "name_suggest": {
          "type": "completion",
          "contexts": [
            {
              "name": "location",
              "type": "geo",
              "path": "address_coordinates"
            }
          ]
        },
        "address_coordinates" : {
          "type": "geo_point"
        },
        "name" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
      }
    }
}
/>

```

**Search**

```auto
<
POST provider/_search
{
  "suggest" : {
    "suggestions" : {
      "prefix" : "allergy",
      "completion" : {
        "field" : "name_suggest",
        "fuzzy": {
          "fuzziness": "AUTO"
        },
        "size": 10,
        "contexts": {
          "location": {
            "lat":35.1239,
            "lon": -80.8648,
            "precision": "30mi"
          }
        }
      }
    }
  }
}
/>

```

---

<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:** [June 2, 2020, 12:39pm UTC](https://discuss.elastic.co/t/geo-context-with-completion-suggester/231149/2 "2020-06-02T12:39:11Z")

</div>

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