使用elasticsearch启动项目报错failed to load elasticsearch nodes 。。。。。No type specified for field [name]
failed to load elasticsearch nodes 。。。。。No type specified for field [name]
翻译: 加载ElasticSearch节点失败。。。。。没有为字段[名称]指定类型
所使用elasticsearch版本为5.6.15
原因一:
如果是使用java类来映射elasticsearch中index下的type
那么当使用@Field注解时,请指定属性的类型
// 引入的包
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; // 像这样
@Field(type = FieldType.Long)
private Long id; // 不可这样, 启动项目时由于不知道属性的类型,所以无法创建index下的type
@Field
private Long id;
但是在做新增操作时,elasticsearch会自动创建类型, 而这个类型下的属性下的参数是有问题的(也可能是我看不懂)
如下图部门名称是自动生成的

其实我们只需要指定部门的类型即可,像这样
@Field(type = FieldType.Text)
private String departmentName;
我们不需要fields这个属性
注意每当我们改变elasticsearch中的index下的type下的属性名的类型或参数时,就我所知只能删除index重新生成(我不知道如何删除index下的type)
否则便会报如下错
You can't change existing mapping type, you need to create a new index with the correct mapping and index the data again
翻译: 不能更改现有的映射类型,需要使用正确的映射创建新的索引,然后重新索引数据。
需要怎么做呢?
删除有问题的索引,为每个属性指定相应的类型。重新索引数据。
使用elasticsearch启动项目报错failed to load elasticsearch nodes 。。。。。No type specified for field [name]的更多相关文章
- Eclipse启动 报错[Failed to load the JNI shared library jvm.dll
准备要做java服务器,在安装开发环境时,启动Eclipse报错[Failed to load the JNI shared library jvm.dll] 研究了下,造成错误的原因是由于eclip ...
- tomcat7 启动项目报错 java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()
JDK版本:jdk1.8.0_77 Tomcat 版本:apache-tomcat-7.0.47 异常重现步骤: 1.完成项目部署 2.启动Tomcat 异常头部信息:java.lang.NoSuch ...
- eclipse启动项目报错:java.lang.ClassNotFoundException: ContextLoaderListener
eclipse 启动项目报错:找不到 Spring 监听器类 org.springframework.web.context.ContextLoaderListener 严重: Error confi ...
- 解决:启动项目报错 java.lang.UnsatisfiedLinkError: D:\Java\apache-tomcat-8.0.17\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
启动项目报错如下: java.lang.UnsatisfiedLinkError: D:\Java\apache-tomcat-8.0.17\bin\tcnative-1.dll: Can't loa ...
- 启动项目报错:org.springframework.beans.factory.UnsatisfiedDependencyException
dubbo项目: 启动项目报错:(web端) org.springframework.beans.factory.UnsatisfiedDependencyException: Error creat ...
- junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题
junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题,说明代码是没问题的,配置也没问题.开始时怀疑是我使用junit版本 ...
- IDEA启动项目报错:Cannot open URL.Please check this URL is correct
IDEA启动项目报错:Cannot open URL.Please check this URL is correct 问题:IDEA启动SSM项目,使用的Tomcat,报错 Cannot open ...
- Springboot项目 配置数据库连接属性后,启动项目报错
Springboot项目 配置数据库连接属性后,启动项目报错,错误如下: 错误原因分析: 1.连接信息配置错误 当使用properties为配置文件时,如图所示,上面的 spring.datasour ...
- 使用laravel-admin后台sdk报错Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID、Provisional headers are shown
报错Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID请先确定自己的资源url是否可以确实访问到(地址正确与否.访问权限是否开启等) 若n ...
随机推荐
- .net core下,Ocelot网关与Spring Cloud Gateway网关的对比测试
有感于 myzony 发布的 针对 Ocelot 网关的性能测试 ,并且公司下一步也需要对.net和java的应用做一定的整合,于是对Ocelot网关.Spring Cloud Gateway网关做个 ...
- Efficient store queue architecture
One embodiment of the present invention provides a store queue that applies the stores to a memory s ...
- keras 的使用
theano 以及 TensorFlow 是 keras 的 backend(后端支持),因此,keras 本质上是对 thenao 或者 TensorFlow 的进一步封装(wrapper). ke ...
- matlab 三维图像的绘制
1. 基本绘图函数 plot3() scatter3() 2. 修饰与点缀 但仅使用默认的配置,调用这些绘图函数,不会很丑,但也漂亮不到哪里去. view(az, el),调整视野和视角:
- C++安全异常std:auto_ptr
auto_ptr它是C++标准库(<utility>)为了一个智能指针类模板来解决资源泄漏所提供的问题(注意:这只是一个简单的智能指针) auto_ptr在事实原则的实现RAII,对资源的 ...
- wpf 实现实时毛玻璃(live blur)效果
原文:wpf 实现实时毛玻璃(live blur)效果 I2OS7发布后,就被它的时实模糊吸引了,就想着能不能将这个效果引入到我们的产品上.拿来当mask肯定会很爽,其实在之前也做过类似的,但是不是实 ...
- ShopNC本地生活o2o网站的源代码,没有域名限制
较前某VIP源代码论坛分享了套ShopNC本地生活o2o站点系统.下载过来却发现根本不能用,所以一直没分享出来.今天咱们这边分享的这套ShopNC本地生活o2o站点源代码,无不论什么的限制,直接ins ...
- 初步STL该容器适配器
容器适配器 特点 容器一定的顺序来实现(让现有的以集装箱堆放/式工作) 分类 1) stack: 头文件 <stack> • 栈 -- 后进先出 2) queue: 头文件 <que ...
- Android自注-15-Activity生命周期
很长一段时间没有写博客,懒,感慨一下. Activity的生命周期是一块以下附图: 通过代码下面简单的介绍一下.一些内容看代码的凝视: package com.mxy; import android. ...
- WPF DataGrid自定义列DataGridTextColumn.ElementStyle和DataGridTemplateColumn.CellTemplate
<Window x:Class="DataGridExam.MainWindow" xmlns="http://schemas.microsoft.c ...