ncolomer / elasticsearch-osmosis-plugin

An Osmosis plugin that index OpenStreetMap data into elasticsearch
Apache License 2.0
101 stars 34 forks source link

EntityDao cannot build Way from projected GetResponse since ES doesn't return shape fields #15

Open christopherlakey opened 10 years ago

christopherlakey commented 10 years ago

Since elasticsearch 1.x does not return shape fields from the index, only from source, the current EntityDao cannot build a Way using the results of buildMultiGetRequest.

Choices are to fetch the entire source object or to store the geometry as a separate non-analyzed field, perhaps encoded as OGC WKT for compactness.

Due to the complex input structure and index representation of shapes, it is not currently possible to sort shapes or retrieve their fields directly. The geo_shape value is only retrievable through the _source field.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-shape-type.html

milovanderlinden commented 9 years ago

I think I resolved the issue by replacing:

request.add(new Item(indexName, type.getIndiceName(), String.valueOf(osmId))
                    .fields("centroid", "lengthKm", "areaKm2", "shape", "tags"));

with

request.add(new Item(indexName, type.getIndiceName(), String.valueOf(osmId)));

And working with fields later in the process