添加任何自定义实体后的 jHipster Elasticsearch 问题

jHispter Elasticsearch issue after adding any custom entity

org.springframework.beans.factory.UnsatisfiedDependencyException: 
  Error creating bean with name 'countryServiceImpl' defined in file [E:\tms-ws\TransportManagement\target\classes\com\baltransport\tms\app\v1\service\impl\CountryServiceImpl.class]: 
  Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'countrySearchRepository': Invocation of init method failed; 
  nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository]: 
    Constructor threw exception; nested exception is org.springframework.data.elasticsearch.ElasticsearchException: Failed to build mapping for country:country
    at org.springframework. ...

添加任何自定义实体后出现此异常 jHispter Elasticsearch 问题。

它第一次运行良好(使用默认 jdl)

你可以试试:

  1. 删除数据库并重新创建。
  2. 导入你的 jdl,随着新闻的变化,也许是新的实体。
  3. 运行 docker 中的弹性搜索。 (在您的项目中找到此文件 .yml)并检查这是否 运行 正确 (localhost:9200)
  4. 运行 您的应用(单体或微服务)

此致

你可以尝试直接从url删除elasticsearch中的索引。 假设你的索引被称为 "user" 你可以做

删除/索引名称