Elasticsearch河,将经度纬度转换为geo_point

时间:2013-05-21 15:13:40

标签: mysql jdbc elasticsearch

我正在使用Elasticsearch的MySQL JPrante JDBC River插件来索引来自MySQL的数据。

在记录集中,我有字段经度(float),纬度(float),图钉(POINT),我如何预设它们被检测为{{1在elasticsearch?

我尝试过:

geo_point

[更新1]

这是javanna映射名称更改为jdbc的错误:

curl -XPUT 'localhost:9200/_river/mysql_jdbc_river/_meta' -d '{
  "type": "jdbc",
  "jdbc": {
    "strategy": "simple",
    "driver": "com.mysql.jdbc.Driver",
    "url": "jdbc:mysql://localhost:3306/somedatabase",
    "user": "someuser",
    "password": "somepassword",
    "sql": "SELECT * FROM activities",
    "poll": "30m",
    "rounding": null,
    "scale": 0,
    "autocommit": false,
    "fetchsize": 10,
    "max_rows": 0,
    "max_retries": 3,
    "max_retries_wait": "10s",
    "digesting": true,
    "acksql": null,
    "acksqlparams": null
  },
  "index": {
    "index": "jdbc",
    "type": "jdbc",
    "bulk_size": 100,
    "max_bulk_requests": 30,
    "index_settings": null,
    "type_mapping": {
      "location_mapping": {
        "properties": {
          "pin": {
            "type": "geo_point",
            "lat_lon": true,
            "store": "yes"
          }
        }
      }
    },
    "versioning": false,
    "acknowledge": false
  }
}'

1 个答案:

答案 0 :(得分:0)

您必须将type_mapping JSON编码为字符串。