我的 JSON (TMPOI_TEMPLATE)
{
"addressInfo": {
"geopoint": {
"lon": 48.845877,
"lat": 8.821861,
}
},
"poiLocation": {
"geopoint": {
"lon": 48.845877,
"lat": 8.821861,
},
"speed": 3.0,
"date": 1461067375605
},
"_id": "f212949c-7b67-45db-9f76-fe18bf951722"
}
我的映射 (TMPOI_MAPPING)
{
"trafficmeasurepoi": {
"properties": {
"addressInfo": {
"properties": {
"geopoint": { "type" : "geo_point" },
}
},
"poiLocation": {
"properties": {
"geopoint": { "type" : "geo_point" },
"speed": { "type" : "double"},
"date": { "type" : "date"}
}
}
}
}
}
我填写索引的方法
索引是由另一个名为createIndex()的方法创建的。它工作正常。但是当我尝试通过以下代码填充索引时,我会得到ERROR
private void fillIndex()
{
// fill index with tmpoi data
Map<String, Object> tmpoi = JsonLoaderUtil.loadJson(TMPOI_TEMPLATE);
String tmPoiId = (String) tmpoi.get("_id");
IndexRequestBuilder req = client.prepareIndex(INDEX_NAME, TMPOI_TYPE, tmPoiId).setSource(tmpoi);
req.setRefresh(true);
IndexResponse res = req.execute().actionGet();
}
错误
MapperParsingException[解析失败]; 嵌套:IllegalStateException [混合字段类型:类 org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType != 字段 _id 上的类 org.elasticsearch.index.mapper.internal.IdFieldMapper$IdFieldType];