当我想在Elasticsearch中创建索引,然后使用putmappings函数设置映射时,失败并得到{“ mappings”:{}}。然后我使用ES6.6.0和Jest Client。如何更正我的代码?
//create index
jestResult = client.execute(new CreateIndex.Builder(indexName).settings(settings).build());
mappingsBuild.startObject()
.startObject(indexName)
.startObject("properties")
.startObject("content").field("type","text")
.field("analyzer","ik_smart")
.field("search_analyzer","ik_max_word").endObject()
.endObject()
.endObject();
PutMapping putMapping = new PutMapping.Builder(indexName,typeName,mappings).build();
jestResult = client.execute(putMapping);
我希望有映射:
"mappings": {
"typeName": {
"properties": {
"content": {
"search_analyzer": "ik_smart",
"analyzer": "ik_max_word",
"type": "text"
}
}
}
}
不是“映射”:{}