pelias / pip-service

Pelias point-in-polygon-service
https://pelias.io
MIT License
16 stars 18 forks source link

PIP service is up and running but /v1/reverse responds with "failed to find geo_point field" #113

Closed pravink closed 4 years ago

pravink commented 4 years ago

Hey team!

I was using your awesome geocoding engine when I noticed something interesting. Let me tell you more about it. PIP service is up and running.. [it took a lot of time to start the service- almost 2-3 hours]


Here's what I did :innocent:

When I do a curl to localhost service it responds correctly -

curl http://localhost:3102/-106.937/34.060 {"continent":[{"id":102191575,"name":"North America","centroid":{"lat":56.498698,"lon":-92.335587},"bounding_box":"-179.143503,5.515082,179.780935,83.634101"}],"country":[{"id":85633793,"name":"United States","abbr":"USA","centroid":{"lat":45.964509,"lon":-113.2686},"bounding_box":"-179.231086,18.86546,179.859681,71.441059"}],"county":[{"id":102081575,"name":"Socorro County","abbr":"SO","centroid":{"lat":34.007241,"lon":-106.930329},"bounding_box":"-107.726557,33.475192,-105.923957,34.58066"}],"locality":[{"id":85976677,"name":"Socorro","centroid":{"lat":34.054404,"lon":-106.906428},"bounding_box":"-106.939594,34.022342,-106.865104,34.098582"}],"region":[{"id":85688493,"name":"NewMexico","abbr":"NM","centroid":{"lat":34.421362,"lon":-106.10838},"bounding_box":"-109.050173,31.332172,-103.001964,37.000293"}]}


Here's what I got :scream_cat:

but when i access it via pelias api /v1/reverse endpoint i got below error example - curl https://staging-geocoder-pelias.domain.com/pelias/api/v1/reverse?point.lon=144.871729&point.lat=-37.791307

{"geocoding":{"version":"0.2","attribution":"http://localhost:3100/attribution","query":{"size":10,"private":false,"point.lat":-37.791307,"point.lon":144.871729,"boundary.circle.lat":-37.791307,"boundary.circle.lon":144.871729,"lang":{"name":"English","iso6391":"en","iso6393":"eng","defaulted":false},"querySize":20},"errors":["[query_shard_exception] failed to find geo_point field [center_point], with { index_uuid=\"cLHAjAWKQ4eHbUpW9lWFgQ\" & index=\"pelias\" }"],"engine":{"name":"Pelias","author":"Mapzen","version":"1.0"},"timestamp":1571180762762},"type":"FeatureCollection","features":[]}

below is the log file content of pelias api -

[api] elasticsearch error [query_shard_exception] failed to find geo_point field [center_point], with { index_uuid="cLHAjAWKQ4eHbUpW9lWFgQ" & index="pelias" } :: {"path":"/pelias/_search","query":{"search_type":"dfs_query_then_fetch"},"body":"{\"query\":{\"bool\":{\"filter\":[{\"geo_distance\":{\"distance\":\"1km\",\"distance_type\":\"plane\",\"center_point\":{\"lat\":-37.791307,\"lon\":144.871729}}},{\"terms\":{\"layer\":[\"venue\",\"address\",\"street\"]}}]}},\"size\":20,\"track_scores\":true,\"sort\":[\"_score\",{\"_geo_distance\":{\"order\":\"asc\",\"distance_type\":\"plane\",\"center_point\":{\"lat\":-37.791307,\"lon\":144.871729}}}]}","statusCode":400,"response":"{\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"failed to find geo_point field [center_point]\",\"index_uuid\":\"cLHAjAWKQ4eHbUpW9lWFgQ\",\"index\":\"pelias\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"dfs\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"pelias\",\"node\":\"2kvKMobtSHyjgyJm4YlRKw\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"failed to find geo_point field [center_point]\",\"index_uuid\":\"cLHAjAWKQ4eHbUpW9lWFgQ\",\"index\":\"pelias\"}}]},\"status\":400}"} 2019-10-15T04:32:49.464Z - ESC[32minfoESC[39m: [api] elasticsearch controller=search, queryType=reverse, es_hits=undefined, result_count=0, es_took=undefined, response_time=undefined, size=10, private=false, point.lat=-37.791307,point.lon=144.871729, boundary.circle.lat=-37.791307, boundary.circle.lon=144.871729, name=English, iso6391=en, iso6393=eng, defaulted=false, querySize=20, retries=0, text_length=0 2019-10-15T04:32:49.464Z - ESC[34mdebugESC[39m: [api] [ES response] 2019-10-15T04:32:49.465Z - ESC[32minfoESC[39m: [api] ::ffff:127.0.0.1 - - [15/Oct/2019:04:32:49 +0000] "GET /v1/reverse?point.lat=-37.791307&point.lon=144.871729 HTTP/1.0" 500 597 2019-10-15T04:36:36.246Z - ESC[34mdebugESC[39m: [api] [lang] 'en' via 'default' 2019-10-15T04:36:36.247Z - ESC[32minfoESC[39m: [api] ::ffff:127.0.0.1 - - [15/Oct/2019:04:36:36 +0000] "GET /v1/reverse?point.lat=-37.791307 HTTP/1.0" 400 405 2019-10-15T04:37:54.173Z - ESC[34mdebugESC[39m: [api] [lang] 'en' via 'header' 2019-10-15T04:37:54.173Z - ESC[34mdebugESC[39m: [api] [ES req] index=pelias, searchType=dfs_query_then_fetch, filter=[$=1km, $=plane, $=-37.791307, $=144.871729, $=[venue, address, street]], $=20, $=true, sort=[_score, $=asc, $=plane, $=-37.791307, $=144.871729]


Here's what I was expecting :sparkles:

let me know if you need some more details from my end..

Here's what I think could be improved :trophy:

orangejulius commented 4 years ago

Hi @pravink,

I've never seen this error before (every time I think I've seen all the Elasticsearch errors I am quickly put in my place).

Can you tell me exactly how you are running Elasticsearch, which version of Elasticsearch you are using, how you set up the Pelias schema, and what version of that you're running as well?

pravink commented 4 years ago

Hi Julian,

I have started ES cluster using terraform script. ES version - 5.6.12 I have created index manually before using curl PUT. I have now dropped the index and recreated with Pelias Schema ./bin/create_index I will keep you posted the result after importing wof data.

Thanks, Pravin!

pravink commented 4 years ago

Hi Julian,

It worked after creating index using Pelias Schema.

only concern is PIP service needs to run on "http" as with https pelias API is giving below issue-

[pip] pip: http://staging-geocoder-pelias-pip.xxxxx.com/2.294471/48.858268 _http_client.js:143 throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol); TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"

is it the correct behaviour? or we can run PIP on https and access it via Pelias API /v1/reverse endpoint?

orangejulius commented 4 years ago

Just following up on this issue. We currently don't support HTTPS for communication to other Pelias services. We probably should, I've opened https://github.com/pelias/pelias/issues/839 to track it