解决:Unable to identify index name. XXXModel is not a Document. Make sure the document class is annota

2020-05-18 15:54:20 浏览数 (1)

1. 往 elasticsearch 写入数据调用 index 方法,执行报错:

代码语言:javascript复制
Unable to identify index name. XXXModel is not a Document.
 Make sure the document class is annotated with @Document(indexName="foo")

2. 原因:XXXModel 实体类上少注解, 加上此注解就可:

代码语言:javascript复制
@Document(indexName = "cxx_es", type = "cxx_es")

0 人点赞