# Context suggester geo

**URL:** <https://discuss.elastic.co/t/context-suggester-geo/45015>\
**Category:** Elasticsearch\
**Created:** [March 21, 2016, 4:05pm UTC](https://discuss.elastic.co/t/context-suggester-geo/45015 "2016-03-21T16:05:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fares/32/45311_2.png) [@fares](https://discuss.elastic.co/u/fares)\
**Post date:** [March 21, 2016, 4:05pm UTC](https://discuss.elastic.co/t/context-suggester-geo/45015/1 "2016-03-21T16:05:44Z")

</div>

Hello,

I m using Elasticsearch 2.2.0.

Trying to make a google like address completion.

I'm using Logstash 2.2 to index addresses in ES with a completion field named `suggest` with a geo context field `pin`. Here's the mappings in my index template.

> ..."properties": {  
> "lonlat":{  
> "properties":{  
> "location": {  
> "type": "geo\_point"  
> }}},  
> "suggest" : { "type": "completion",  
> "context":{  
> "pin": { "type":"geo", "precision":["1km","5m"], "neighbors":true,  
> "path":"location",  
> "default":{"lat":0.0,"lon":0.0}  
> }  
> },  
> "payloads" : true,  
> "analyzer" : "custom\_index\_analyzer",  
> "search\_analyzer": "custom\_search\_analyzer" },...

When I try completion suggester without context it works well, but when I add the geo context field named "pin" in the mapping properties i don't have any result.

Here's the related parts of my logstash config :

```
    ...csv {columns => ["ID","numero","voie","code_postal","nom_commune","source","latitude","longitude"] separator => ","}
    if [latitude] and [longitude] {
        # move into own location object for additional geo_point type in ES
        # copy field, then merge to create array for bettermap
        mutate {
          rename => ["latitude", "[location][lat]", "longitude", "[location][lon]" ]
          add_field => { "lonlat" => ["%{[location][lat]}", "%{[location][lon]}" ] }
        }
      }...
       mutate {convert => ["[location][lat]", "float" ]
                      convert => ["[location][lon]", "float" ]
       }...

```

Then here is my query :

> POST http://@:9200/index/\_suggest/  
> {  
> "suggest" : {  
> "text" : "16 ",  
> "completion" : {  
> "field" : "suggest",  
> "size": 10,  
> "context": {  
> "pin":{"lon":2.29,"lat":48.75}  
> }  
> }  
> }  
> }

When I put lon:0 and lat:0 it works but it doenst filter the results.

Any help please to make it consider the geo context ? Thanks

---

<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:** [July 5, 2017, 11:06pm UTC](https://discuss.elastic.co/t/context-suggester-geo/45015/2 "2017-07-05T23:06:30Z")

</div>


