gpt4 book ai didi

elasticsearch - IllegalStateException用于混淆字段类型

转载 作者:行者123 更新时间:2023-12-02 22:19:39 25 4
gpt4 key购买 nike

我的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"
}

我的 map (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[failed to parse]; nested: IllegalStateException[Mixing up field types: class org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType != class org.elasticsearch.index.mapper.internal.IdFieldMapper$IdFieldType on field _id];

最佳答案

_id是保留字段。尝试从TMPOI_TEMPLATE中删除以下行(“_id”:“f212949c-7b67-45db-9f76-fe18bf951722”),然后找到另一种传递文档ID的方法。
希望能帮助到你。

关于elasticsearch - IllegalStateException用于混淆字段类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36982849/

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