How do I use Elasticsearch's geo_point and geo_shape types at the same time? -
here our document:
{ "geometry" : { "type" : "point", "coordinates" : [ -87.662682, 41.843014 ] } } we'd geo_shape search _geo_distance sort, both against same geometry field. former requiresgeo_shape types while latter requires geo_point.
these 2 indexes succeed individually, not together:
"geometry": { "type": "geo_shape" } and
"geometry": { "properties": { "coordinates": { "type": "geo_point" } } }, so far we've tried these , failed:
"geometry": { "type": "geo_shape" }, "geometry.coordinates": { "type": "geo_point" }, also
"geometry": { "copy_to": "geometryshape", "type": "geo_shape" }, "geometryshape": { "properties": { "coordinates": { "type": "geo_point" } } } also
"geometry": { "copy_to": "geometryshape", "properties": { "coordinates": { "type": "geo_point" } } }, "geometryshape": { "type": "geo_shape" } any ideas on how create index properly?
if scripting enabled achieve via specifying transforms in mapping
would on these lines :
put test/test_type/_mapping { "transform": { "script": "if (ctx._source['geometry']['coordinates']) ctx._source['test'] = ctx._source['geometry']['coordinates']", "lang": "groovy" }, "properties": { "geometry": { "type": "geo_shape" }, "coordinates": { "type": "geo_point" } } }
Comments
Post a Comment