今天在写测试时,运行错误,提示这样一句话:
mapping source must be pairs of fieldnames and properties definition.
大概意思是:映射源必须是字段名和属性定义对。
图中标红的就是出现错误的地方!!!
后来经过百度发现,如果导入create方法是过时的方法,则需要mapping 方法中加"_doc"。
creatRequest.mapping("_doc",mapping, XContentType.JSON);
今天在写测试时,运行错误,提示这样一句话:
mapping source must be pairs of fieldnames and properties definition.
大概意思是:映射源必须是字段名和属性定义对。
图中标红的就是出现错误的地方!!!
后来经过百度发现,如果导入create方法是过时的方法,则需要mapping 方法中加"_doc"。
creatRequest.mapping("_doc",mapping, XContentType.JSON);