ES的安装和开发配置坑

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

 

安装步骤:

下载地址:https://www.elastic.co/cn/start?elektra=home&&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/

Version7.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包


            org.elasticsearch.plugin
            transport-netty4-client
            6.3.2
       

--------------------- 
作者:wolf_love666 
来源:CSDN 
原文:https://xiaochengxinyizhan.blog.csdn.net/article/details/89482433 
版权声明:本文为博主原创文章,转载请附上博文链接!

 

你可能感兴趣的:([,44,],Lucene,&,elasticsearch)