0
にアナライザを適用します。は、私は、このアナライザを持っているオブジェクトフィールド
{
"index": {
"number_of_shards": 1,
"analysis": {
"filter": {
"word_joiner": {
"type": "word_delimiter",
"catenate_all": true,
"preserve_original": true
}
},
"analyzer": {
"word_join_analyzer": {
"type": "custom",
"filter": [
"word_joiner"
],
"tokenizer": "keyword"
}
}
}
}
}
私はこの場でそれを適用します。
@Field(type = FieldType.Object, analyzer = "word_join_analyzer")
private Description description;
そして、ここでは説明のクラスです:
public class Description {
@JsonProperty("localizedDescriptions")
private Map<String, String> descriptions = new HashMap<>();
}
これは、このフィールドの結果のElasticsearchマッピング:
{
"description":{
"properties":{
"localizedDescriptions":{
"properties":{
"en":{
"type":"string"
},
"fr":{
"type":"string"
},
"it":{
"type":"string"
}
}
}
}
}
}
ご覧のように、アニリンザーはまったく適用されません。これは文字列フィールドでうまく動作しますが、Object型では苦労します。何か案は?
ありがとうございます!
EDIT:私は動的マッピングを使用してみました:
{
"iam":{
"properties":{
"dynamic_templates":[
{
"localized_strings_values":{
"path_match":"description.localizedDescriptions.*",
"mapping":{
"type":"string",
"analyzer":"word_join_analyzer"
}
}
}
]
}
}
}
をしかし、私はこのエラーを持っている:
Expected map for property [fields] on field [dynamic_templates] but got a class java.lang.String
は、なぜ私はこのエラーが出るのですか?
アナライザーをオブジェクトフィールドに適用することはできません。必要なすべての文字列フィールドに明示的に追加する必要があります。 – Val
この場合、どうすればいいですか?それは地図です。 – Anna
アナライザーを説明フィールドに直接入力しようとしましたか? – Val