场景:我正在尝试将json数据索引为弹性数据。我收到一个错误,就像
17:13:38.146主要错误com.opnlabs.lighthouse.elastic.ElasticSearchIndexer - {"root_cause":[{"type":"illegal_argument_exception",“原因”:“不能将非对象映射map.audits.map.font-size.map.details.map.items.myArrayList.map.selector与对象映射map.audits.map.font-size.map.details.map.items.myArrayList.map.selector"}],”类型“:”illegal_argument_exception“合并,“原因”:“不能将非对象映射map.audits.map.font-size.map.details.map.items.myArrayList.map.selector与对象映射map.audits.map.font-size.map.details.map.items.myArrayList.map.selector"}合并
是什么引起了这个问题?请帮帮忙
代码
JSONObject newJsonObject = new JSONObject();
JSONObject log = jsonObject.getJSONObject("audits");
JSONObject log1 = jsonObject.getJSONObject("categories");
newJsonObject.put("audits", log);
newJsonObject.put("categories", log1);
newJsonObject.put("timeStamp", time);
Index index = new Index.Builder(newJsonObject).index(mongoIndexName+"1").type("data").build();
DocumentResult a = client.execute(index);基本上,我试图将3 json值添加到弹性指数中。请帮我解决我做错的事。
发布于 2018-11-20 14:07:42
错误消息意味着您正在尝试更改现有的映射。然而,在Elasticsearch中,这是不可能的。一旦创建了映射,就无法更改映射。
您不能更改现有的映射类型,您需要创建一个具有正确映射的新索引,并再次对数据进行索引。
因此,您必须创建一个新的索引来创建此映射。取决于情况,你可以
当然,在后一种情况下,您将丢失索引中的所有数据,因此相应地做好准备。
https://stackoverflow.com/questions/53394626
复制相似问题