小编Neh*_*iya的帖子

带有 Spring Data ElasticSearch 的 GeoPoint 给出错误:QueryParsingException[field [location] is not a geo_point field]

我在春季有弹性搜索实体,如下所示:

@Document(indexName = "cities_in", type = "cities")
public class CityDocument {

@Id
private String id;

@Field(type = FieldType.String)
private String city;

@Field(type = FieldType.Object)
@GeoPointField
private GeoPoint location;
}
Run Code Online (Sandbox Code Playgroud)

但是当我使用 curl 看到映射时,我curl -s -XGET 'http://localhost:9200/cities_in/cities/_mapping?pretty=1'得到的输出为:

  {
   "cities_in" : {
   "mappings" : {
    "cities" : {
      "properties" : {
        "city" : {
          "type" : "string"
        },
        "id" : {
         "type" : "string"
      },
      "location" : {
        "properties" : {
          "geohash" : {
            "type" : "string"
          },
          "lat" : { …
Run Code Online (Sandbox Code Playgroud)

spring elasticsearch geopoints spring-data-elasticsearch

2
推荐指数
2
解决办法
3109
查看次数