ES的安装和开发配置坑

转载地址:https://xiaochengxinyizhan.blog.csdn.net/article/details/89482433

 

安装步骤:

下载地址:https://www.elastic.co/cn/start?elektra=home&amp&storm=banner


解压:

启动安装程序


自动弹出CMD命令

执行http://localhost:9200/


修改 elasticsearch.yml

文件需加入的内容
http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true
放开注释的内容
放开network.host: 192.168.0.1的注释并改为network.host: 0.0.0.0(这里如果不修改的话,外网无法访问与是否安装head无关)
放开cluster.name;node.name;http.port的注释

1
2
3
4
5
6
7
8
9
双击 elasticsearch.bat 重启

安装node.js

下载链接:https://nodejs.org/en/download/

下载head插件
步骤命令:

 git clone git://github.com/mobz/elasticsearch-head.git
 cd elasticsearch-head
 npm install
 npm run start
 open http://localhost:9100/
下载地址:https://github.com/mobz/elasticsearch-head

如果不想这么安装上面的那么多可以直接安装Google的插件
https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm/

Version??7.x 的报错信息

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
}
],
"type": "illegal_argument_exception",
"reason": "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
},
"status": 400
}
1
2
3
4
5
6
7
8
9
10
11
12
13
参考解决方案:
https://github.com/elastic/elasticsearch-php/issues/883
https://github.com/OSGeo/gdal/issues/1246
https://fossies.org/linux/elasticsearch/docs/reference/mapping.asciidoc


{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [people] as the final mapping would have more than 1 type: [_doc, man]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [people] as the final mapping would have more than 1 type: [_doc, man]"
},
"status": 400
}
1
2
3
4
5
6
7
8
9
10
11
12
13
只支持一个index的type现在称为doc

(1)No handler for type [string] declared on field

{"reason":"Failed to parse mapping [umc_synclog_data]:
 No handler for type [string] declared on field [response]",
 "caused_by":{"reason":"No handler for type [string] declared on field [response]",
 "type":"mapper_parsing_exception"},
 "type":"mapper_parsing_exception",
 "root_cause":[{"reason":"No handler for type [string] declared on field [response]",
 "type":"mapper_parsing_exception"}]}
1
2
3
4
5
6
7
ES版本5.x以上没有string类型,改为text或者keyword

(2)analyzer [ik_max_word] not found for field

{"reason":"Failed to parse mapping[umc_synclog_data]: 
analyzer [ik_max_word] not found for field[response]",
"caused_by":{"reason":"analyzer [ik_max_word] not foundfor field[response]",
"type":"mapper_parsing_exception"},
"type":"mapper_parsing_exception",
"root_cause":[{"reason":"analyzer[ik_max_word] not found for field[response]",
"type":"mapper_parsing_exception"}]}
1
2
3
4
5
6
7
需要修改配置文件去掉旧有分词

(3)ERROR org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository - failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException:
None of the configured nodes are available:


(4)使用创建实例的时候默认client客户端实例化需要初始化两个管理员一个是集群管理员,一个是索引管理员。

Caused by: java.lang.NullPointerException
at org.elasticsearch.common.io.stream.StreamOutput.writeString

Caused by: java.lang.ClassNotFoundException: org.elasticsearch.common.transport.InetSocketTransportAddress
缺少jar包:spring-data-elasticSearch的话看这个链接
https://elasticsearch.cn/question/5002
原生的jar包引入的话加下面的这个jar包

<dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>transport-netty4-client</artifactId>
            <version>6.3.2</version>
        </dependency>
--------------------- 
作者:wolf_love666 
来源:CSDN 
原文:https://xiaochengxinyizhan.blog.csdn.net/article/details/89482433 
版权声明:本文为博主原创文章,转载请附上博文链接!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

安得权

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值