【发布时间】:2019-06-10 12:57:19
【问题描述】:
我想在 Entity 中映射字段,例如 @CompletionField,但使用上下文,因为现在 Completion 包括 String[] 和 int 权重字段。我想过滤索引中的完成。
@Document(indexName = "compl_index")
public class ComplIndex {
@CompletionField
private Completion suggestions;
}
当我编写这个类时,我有一个简单的字符串数组和权重完成,但我想像这样映射实体,并使用上下文。我尝试解决这个问题 - 编写一个具有字段类型、上下文等的新实体并使用映射进行注释,CompletionFieldMapper 抛出异常“字段不支持上下文字段:...
"name": {
"type": "completion",
"contexts": [
{
"name": "year",
"type": "category",
"path": "year"
}
]
},
"year": {
"type": "text"
}
【问题讨论】:
-
欢迎来到stackoverflow。你能提供更多细节吗?你都尝试了些什么?请阅读stackoverflow.com/help/how-to-ask
-
@zohar.kom 我的问题的新描述
标签: java spring-data spring-data-elasticsearch