Ich habe ein paar Elasticsearch-Felder, die ich vor der Indexierung nicht analysieren möchte. Ich habe gelesen, dass der richtige Weg dies zu tun ist, indem Sie das Index-Mapping ändern. Gerade jetzt meine Abbildung sieht wie folgt aus:Konfigurieren Sie elasticsearch mapping mit java api
{
"test" : {
"general" : {
"properties" : {
"message" : {
"type" : "string"
},
"source" : {
"type" : "string"
}
}
}
}
}
Und ich würde es so aussehen mag:
{
"test" : {
"general" : {
"properties" : {
"message" : {
"type" : "string",
"index" : "not_analyzed"
},
"source" : {
"type" : "string"
}
}
}
}
}
Ich habe versucht, die Einstellungen über
client.admin().indices().prepareCreate("test")
.setSettings(getGrantSettings());
Wo getGrantSettings sich ändern() sieht so aus:
static Settings getGrantSettings(){
JSONObject settingSource = new JSONObject();
try{
settingSource.put("mapping", new JSONObject()
.put("message", new JSONObject()
.put("type", "string")
.put("index", "not_analyzed")
));
} catch (JSONException e){
e.printStackTrace();
}
Settings set = ImmutableSettings.settingsBuilder()
.loadFromSource(settingSource.toString()).build();
return set;
}
Ich sehe hier keine Frage. Hast du Probleme? Wenn ja welche? –