Question:
Failed to parse mapping [person]: Root mapping definition has unsupported parameters: [source : {chineseName={search_analyzer=ik_smart, analyzer=ik_max_word, type=string}}]
public void createMapping() throws IOException {
try {
XContentBuilder personBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject(Global.ELASTICSEARCH_TYPE)
.startObject(Global.ELASTICSEARCH_SOURCE)
.startObject("chineseName").field("type", "string")
.field("analyzer", "ik_max_word").field("search_analyzer", "ik_smart")
.endObject()
.endObject().endObject().endObject();
IndicesAdminClient indicesAdminClient = getClient().admin().indices();
indicesAdminClient.prepareCreate(Global.ELASTICSEARCH_INDEX).setSettings()
.addMapping(Global.ELASTICSEARCH_TYPE, personBuilder).get();
} catch (Exception e) {
e.printStackTrace();
}
}