我的JSON(TMPOI_TEMPLATE)IllegalStateException異常爲字段類型混合起來
{
"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()。它的工作正常。但是當我試圖填補下面的代碼索引我會得到錯誤
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!= class org.elasticsearch.index.mapper.internal.IdFieldMapper $ IdFieldType on field _id];