在索引之前,我有一些我不想分析的弹性搜索字段.我已经读过,正确的方法是改变索引映射.现在我的映射看起来像这样:
{
"test" : {
"general" : {
"properties" : {
"message" : {
"type" : "string"
},
"source" : {
"type" : "string"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像这样:
{
"test" : {
"general" : {
"properties" : {
"message" : {
"type" : "string",
"index" : "not_analyzed"
},
"source" : {
"type" : "string"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我一直试图通过改变设置
client.admin().indices().prepareCreate("test")
.setSettings(getGrantSettings());
Run Code Online (Sandbox Code Playgroud)
getGrantSettings()的位置如下:
static Settings getGrantSettings(){
JSONObject settingSource = new JSONObject();
try{
settingSource.put("mapping", new JSONObject()
.put("message", new JSONObject() …Run Code Online (Sandbox Code Playgroud)