Reputation: 3785
I wan to make use of elastic search shape queries which work well with spring-data-es so far. The problem is when creating the index from my java application the automatic mapping looks like this:
"shape" : {
"properties" : {
"coordinates" : {
"type" : "double"
},
"type" : {
"type" : "string"
}
}
}
So it just Indexes all my coordinates as double array while I need this:
"shape": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "5m"
}
So. How to implement a custom mapping? There is a annotation called @GeoPointField which makes a GeoPoint mapping. That one looks not to complicated so implementing this by myself shouldn't be to much of a problem but I can't find the implementation for the annotation and so I'm kinda stuck. Also ok would be to use: ElasticSearchTemplate.putMapping(indexName, type, mapping)
but I can't find what to put into mapping as its Type Object.
Upvotes: 0
Views: 1851
Reputation: 217554
I've ran into the exact same issue a while ago and the problem is that Spring Data ES (as of May 11th, 2016) doesn't support geo shapes. As can be seen in DATAES-169, the issue hasn't gotten much traction yet.
For this reason, I've forked the official spring-data-elasticsearch repository and decided to implement it myself.
I've made it work for polygons and circles, but I haven't pushed my code yet. I intend to support all shapes before pushing and submitting a PR. Stay tuned...
Upvotes: 1