1
我使用Elasticsearch的MySQL JPrante JDBC River插件來從MySQL索引數據。Elasticsearch河,將經度緯度轉換爲geo_point
在一個記錄我有字段經度(float
),緯度(float
),銷(POINT
),如何可以預設它們被檢測爲一個elasticsearch geo_point
?
我試圖與:
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
}
}'
[UPDATE 1]
這裏是與映射的名稱變更爲通過javanna描述JDBC錯誤:
[2013-05-21 13:20:58,256][WARN ][river.jdbc ] [node-0] [jdbc][mysql_jdbc_river] failed to create index [jdbc], disabling JDBC river...
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse mapping definition
at org.elasticsearch.index.mapper.DocumentMapperParser.extractMapping(DocumentMapperParser.java:245)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:155)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:383)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:379)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$4.execute(MetaDataMappingService.java:310)
at org.elasticsearch.cluster.service.InternalClusterService$2.run(InternalClusterService.java:229)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:95)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value
at [Source: {jdbc={properties={pin={lat_lon=true, type=geo_point}}}}; line: 1, column: 7]
at org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1378)
at org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:599)
at org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:520)
at org.elasticsearch.common.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:616)
at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:50)
at org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:70)
at org.elasticsearch.common.xcontent.support.XContentMapConverter.readOrderedMap(XContentMapConverter.java:60)
at org.elasticsearch.common.xcontent.support.AbstractXContentParser.mapOrdered(AbstractXContentParser.java:126)
at org.elasticsearch.index.mapper.DocumentMapperParser.extractMapping(DocumentMapperParser.java:243)
... 9 more
[2013-05-21 13:20:58,264][INFO ][cluster.metadata ] [node-0] [_river] update_mapping [mysql_jdbc_river] (dynamic)
你試過了嗎?任何錯誤?當你使用get mapping api檢索映射時,你會得到什麼?它是否得到應用? – javanna
首先,您映射中的類型名稱與您在註冊河流時配置的類型不匹配。應該是'jdbc'。 – javanna
在json中看起來像是一個問題,但我乍看之下看不到它。在發送之前驗證它。 – javanna