Can't get Context Suggest to work with location and path


(thinkmusic) #1

I've been trying to get a simple sample of the Context Suggester to work with a location and path and seems like there may be something wrong. Seems like it should at least be able to suggest from the same location.

Any help is really appreciated!!

Here's the example:

CREATEINDEX:
PUT /services
{
"number_of_shards" : 1,
"number_of_replicas" : 1
}

MAPPING:
PUT /services/service/_mapping
{
"service": {
"properties": {
"name": {
"type": "string"
},
"pin": {
"type":"geo_point"
},
"suggest_field": {
"type": "completion",
"context": {
"location": {
"type": "geo",
"precision": "5km",
"neighbors": true,
"path":"pin",
"default": {
"lat": 0.0,
"lon": 0.0
}
}
}
}
}
}
}

ADDRECORD:
PUT /services/service/1
{
"name": "knapsack",
"pin": {
"lat": 47.620499,
"lon": -122.350876
},
"suggest_field": {
"input": [
"knacksack",
"backpack",
"daypack"
]
}
}

SUGGEST:
POST /services/_suggest
{
"suggest": {
"text": "k",
"completion": {
"field": "suggest_field",
"size": 10,
"context": {
"location": {
"lat": 47.620499,
"lon": -122.350876
}
}
}
}
}


(thinkmusic) #2

I believe this to be an Elasticsearch bug. I spent a lot of time testing different scenarios. Works when not using a Path. This is 1.7.4 on Found.


(thinkmusic) #3

Can someone actually get this example to work. Please confirm as it doesn't work for me. on 1.7.4.


(system) #4