当我在类

时间:2017-05-09 06:12:14

标签: java spring spring-data-elasticsearch

首先我在Springboot项目中使用以下版本:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-elasticsearch</artifactId>
    <version>2.1.3.RELEASE</version>
</dependency>

我的班级是这样的:

//@GeoPointField
private GeoPoint location;
//@Field(index = FieldIndex.not_analyzed)
private String userId;

当我使用Annotation时,es映射位置如下:

"location": {
  "properties": {
    "lon": {
     "type": "double"
    },
    "lat": {
     "type": "double"
   }
  }
}

我想要的是:location&#39; type是geo_point。

当然,当我删除除@Id之外的所有注释时,它确实。

但我希望注释能够做一些功能,请提供一些想法。

1 个答案:

答案 0 :(得分:-1)

我也遇到了// "Lat,Lon" @GeoPointField private String location; 的问题,而是使用了#!/usr/bin/python from time import time,sleep from math import sin,pi frequency = 1 amplitude = 100 resolution = 0.01 def sineCalc(time,frequency,amplitude): factor = pi * frequency sin_seg = sin(time * factor) value = amplitude * sin_seg return value while True: #Get y value based on current time. value = sineCalc(time(),frequency,amplitude) print str(value) sleep(resolution)

https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-geo-point-type.html#_lat_lon_as_string_6

{{1}}