Create index in es 5.1.1 on Jave api

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();
		}
	}

It goes well when I change "source" to "properties". Is it standard?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.