-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Analytics/GeoIndexing, search aggregations of geo points and shapesIndexing, search aggregations of geo points and shapes>bug
Description
Elasticsearch version:
5.1.2
Description of the problem including expected versus actual behavior:
Here is the search I want to run:
POST stores_search/_search?
{
"suggest": {
"store-suggest": {
"prefix": "Combs",
"completion": {
"field": "suggest",
"fuzzy": {
"fuzziness": "AUTO",
"transpositions": true
},
"size": 100,
"contexts": {
"location": [
{
"lat": 47.6062,
"lon": -122.3321,
"precision": "100m"
}
]
}
}
}
}
}
I need to provide my precision in distance. The docs state this is possible:
The precision of the geohash to encode the query geo point. This can be specified as a distance value (5m, 10km etc.), or as a raw geohash precision (1..12). Defaults to index time precision level.
But instead of getting stores within that geo location, I get this error response:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 57
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query_fetch",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "stores_search",
"node": "Se4Iz_2cS4OGdz33kndgGg",
"reason": {
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 57,
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"1000mi\""
}
}
}
],
"caused_by": {
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 57,
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"1000mi\""
}
}
},
"status": 400
}
If i change precision to 1 (or any number in (1..12)), my search completes with no errors.
Steps to reproduce:
- Create a mapping as an example try:
PUT place
{
"mappings": {
"shops" : {
"properties" : {
"suggest" : {
"type" : "completion",
"contexts": [
{
"name": "place_type",
"type": "category",
"path": "cat"
},
{
"name": "location",
"type": "geo",
"precision": 4
}
]
}
}
}
}
}
- Put some documents in the new index, as an example:
PUT place/shops/1
{
"suggest": {
"input": "timmy's",
"contexts": {
"location": [
{
"lat": 43.6624803,
"lon": -79.3863353
},
{
"lat": 43.6624718,
"lon": -79.3873227
}
]
}
}
}
- Do a lil' query:
POST place/_suggest?pretty
{
"suggest" : {
"prefix" : "tim",
"completion" : {
"field" : "suggest",
"size": 10,
"contexts": {
"location": [
{
"lat": 43.6624803,
"lon": -79.3863353,
"precision": "2m"
},
{
"context": {
"lat": 43.6624803,
"lon": -79.3863353
},
"boost": 2
}
]
}
}
}
}
result:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 62
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "place",
"node": "Se4Iz_2cS4OGdz33kndgGg",
"reason": {
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 62,
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"2m\""
}
}
}
],
"caused_by": {
"type": "parsing_exception",
"reason": "[geo] failed to parse field [precision]",
"line": 1,
"col": 62,
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"2m\""
}
}
},
"status": 400
}
Provide logs (if relevant):
wbyoung
Metadata
Metadata
Assignees
Labels
:Analytics/GeoIndexing, search aggregations of geo points and shapesIndexing, search aggregations of geo points and shapes>bug