-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
I ned to use the geo context for my autocomplete. But it is not returning any results. When I run the autocomplete query without the context, results are returned.
-
Autocomplete query with context:
===============================
GET staging/_search
{
"suggest": {
"suggestion": {
"prefix": "Südsteiermark",
"completion": {
"field": "autoCompleteName",
"size": 10,
"contexts": {
"locationContext": [{
"lat": "40.74164831951294",
"lon": "-73.98714780807495",
"precision": 12
}]
}
}
}
}
}
==================================
RESULT of Autocomplete query with context
====================================
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"suggestion": [
{
"text": "Südsteiermark",
"offset": 0,
"length": 13,
"options": []
}
]
}
}
=================================== -
RESULT OF QUERY WITHOUT CONTEXT:
===========================
"took": 1713,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"suggestion": [
{
"text": "Südsteiermark",
"offset": 0,
"length": 13,
"options": [
{
"text": "Südsteiermark, Tement, Zieregg 2008",
"_index": "staging",
"_type": "menuitemES",
"_id": "591df0affa035585189619510x3bc",
"_score": 1,
"_source": {
"venueId": "457ebeaaf964a5203f3f1fe3",
"name": "Eleven Madison Park",
"locP": {
"type": "Point",
"coordinates": [
40.74164831951294,
-73.98714780807495
]
========================================
- Mapping portion:
"autoCompleteName": {
"type": "completion",
"analyzer": "standard",
"preserve_separators": true,
"preserve_position_increments": false,
"max_input_length": 50,
"contexts": [
{
"name":"locationContext",
"type":"geo",
"precision":"25m",
"path":"locP"
}
]
=====================================
Please suggest what is wrong.