{
"mappings": {
"news" : {
"properties" : {
"title" : {
"type": "text",
"analyzer": "ik_max_word",
"fields": {
"suggest" : {
"type" : "completion",
"analyzer": "ik_max_word"
}
}
},
"content": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
}
"mappings": {
"news" : {
"properties" : {
"title" : {
"type": "text",
"analyzer": "ik_max_word",
"fields": {
"suggest" : {
"type" : "completion",
"analyzer": "ik_max_word"
}
}
},
"content": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
}
2 个回复
JackGe
赞同来自: xuejl 、CarrieJin
String esMapping = JsonXContent.contentBuilder().startObject().startObject("mappings").startObject("news").startObject("properties").startObject("title") .field("type", "text").field("analyzer", "ik_max_word").startObject("fields").startObject("suggest").field("type", "completion") .field("analyzer", "ik_max_word").endObject().endObject().endObject().startObject("content").field("type", "text") .field("analyzer", "ik_max_word").endObject().endObject().endObject().endObject().endObject().string();
方法二:
构造Json字符串
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: