gpt4 book ai didi

mysql - Elasticsearch river,将经度纬度转换为geo_point

转载 作者:行者123 更新时间:2023-11-30 23:18:12 29 4
gpt4 key购买 nike

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

在记录集中,我有字段经度 (float)、纬度 (float)、pin (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
}
}'

[更新 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)

最佳答案

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

关于mysql - Elasticsearch river,将经度纬度转换为geo_point,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16673480/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com