我的实体类:
@CompletionField(maxInputLength = 200)
private Completion titleSuggestion;
保存的方法
UrlIndex urlIndex = elasticsearchOperations.save(url);
通过devtools查询是不是Completion类型:
GET /xxx/_mapping
发现是text类型
"titleSuggestion": {
"properties": {
"input": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
这是为什么?
解决了,原来要提前声明设置,如下:
加好之后,再执行命令就可以看到了:
执行结果成功了!