我有实际上包含嵌套类型的架构,如下所示。
这是主要模式。
@Document(indexName = "agreement")
public class PromotionSearchSchema {
@Field(type = FieldType.Nested, includeInParent = true)
private Promotion promotionproduct;
}
现在,Promotion 是主模式中的另一个实体。所以我把它标记为嵌套类型。在 Promotion 实体中,我正在尝试添加分析器,如下所示
@Setting(settingPath = "es-config/elastic-analyzer.json")
public class Promotion {
@Field(type = FieldType.Text, analyzer = "autocomplete_index", searchAnalyzer = "autocomplete_search")
private String promotionDescription;
}
这是我的 elastic-analyzer.json
{
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete_search": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase"
]
},
"autocomplete_index": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
当我喜欢时,根本不会在 Elasticsearch 中创建完整的映射。它只是创建如下所示
{
"agreement" : {
"mappings" : { }
}
}
所以我的问题是如何在嵌套类型中添加分析器。任何帮助,将不胜感激。