我正在使用elasticsearch river插件版本1.3.0.4,这是本文的最新内容,针对elasticsearch版本1.3.2。 我正在尝试使用geo_point类型创建映射,但我一直没有这样做... 这是我的映射:
PUT /_river/tehotels/_meta
{
"type": "jdbc",
"jdbc": {
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://localhost:3306/blah",
"user": "",
"password": "",
"sql": "select id,hotel_id,hotel_name,hotel_url,hotel_address,overview,city_id,star_rating,latitude as \"location.lat\",longitude as \"location.lon\" from agoda_hotels",
"strategy": "simple",
"autocommit": true,
"fetchsize": 10,
"max_rows": 0,
"max_retries": 3,
"max_retries_wait": "30s",
"maxbulkactions": 1000,
"maxconcurrentbulkactions": 8,
"index": "teindex8",
"type": "hotels",
"type_mapping": {
"hotels": {
"properties": {
"_id": {
"type": "long"
},
"hotel_id": {
"type": "long"
},
"hotel_name": {
"type": "string"
},
"hotel_url": {
"type": "string",
"index": "no"
},
"hotel_address": {
"type": "string",
"index": "no"
},
"overview": {
"type": "string",
"index": "no"
},
"city_id": {
"type": "long",
"index": "no"
},
"star_rating": {
"type": "float"
},
"location": {
"type": "geo_point"
}
}
}
}
}
}
但是当我运行_mapping
命令时,它显示为:
{
"teindex8": {
"mappings": {
"hotels": {
"properties": {
"city_id": {
"type": "long"
},
"hotel_address": {
"type": "string"
},
"hotel_id": {
"type": "long"
},
"hotel_name": {
"type": "string"
},
"hotel_url": {
"type": "string"
},
"id": {
"type": "long"
},
"location": {
"properties": {
"lat": {
"type": "string"
},
"lon": {
"type": "string"
}
}
},
"overview": {
"type": "string"
},
"star_rating": {
"type": "double"
}
}
}
}
}
}
请注意"位置"不是geo_point类型,而是属性列表。怀疑,当我发出搜索位置的查询时,我收到错误:
POST /teindex8/hotels/_search
{
"query": {
"filtered": {
"filter": {
"geo_distance": {
"distance": "20 km",
"location": "13.441111, 103.858611"
}
}
}
}
}
结果:
QueryParsingException[[teindex8] failed to find geo_point field [location]];
有人知道如何解决问题吗?我似乎完全按照文档......
答案 0 :(得分:0)
它与elasticsearch的版本有关。 jdbc-river插件仍然与elasticsearch 1.3.2不兼容。
升级elasticsearch时,您始终需要确保其插件的兼容性。其中一些可能不受支持。
对于jdbc-river插件,您始终必须检查jprante插件repo。