[英]ElasticSearch - Geo Spatial search on location array
I am creating an index with two types Restaurant and Branch with Spring Data. 我用两种类型的餐厅和带有弹簧数据的分支创建索引。 Restaurant has many branches as nested type. 餐厅有许多分支机构为嵌套类型。 When I create this mapping, Spring Data / ElasticSearch automatically converts the location field inside the Branch type as latitude , longitude array, hence geo spatial query is not possible. 创建此映射时,Spring Data / ElasticSearch会自动将Branch类型内的location字段转换为latitude,经度数组,因此无法进行地理空间查询。 Here it is: 这里是:
I want to perform a search on branch.location for geo spatial search, but elastic search is not treating location as geopoint, rather a string array, hence it is not possible, please suggest what I need to do or where I am getting wrong. 我想在branch.location上执行搜索,以进行地理空间搜索,但是弹性搜索未将位置视为地理点,而是一个字符串数组,因此这是不可能的,请提出我需要做的事情或哪里出错了。
class Restaurant {
@Field( type = FieldType.Nested)
private List<Branch> branches = new ArrayList<Branch>();
}
class Branch {
private GeoPoint location;
}
Make sure you are using 确保您正在使用
org.springframework.data.elasticsearch.core.geo.GeoPoint org.springframework.data.elasticsearch.core.geo.GeoPoint
And not 并不是
org.elasticsearch.common.geo.GeoPoint org.elasticsearch.common.geo.GeoPoint
Alternatively (and perhaps better), define the mapping yourself instead of letting spring/elasticsearch do it for you. 另外(也许更好),请自己定义映射,而不是让spring / elasticsearch为您完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.