1、centos7以前的版本需要关闭 bootstrap.memory_lock,配置内容如下:
原因:
这是在因为Centos6不支持SecComp,而ES6.1.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
可以查看issues
https://github.com/elastic/elasticsearch/issues/22899
2、ik最新插件安装
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.1.1/elasticsearch-analysis-ik-6.1.1.zip
测试步骤如下:
curl -XPOST http://11.0.0.35:9200/index/fulltext/_mapping -H 'Content-Type: application/json' -d'
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}'
curl -XPOST http://11.0.0.35:9200/index/fulltext/1 -H 'Content-Type: application/json' -d'
{"content":"美国留给伊拉克的是个烂摊子吗"}
'
curl -XPOST http://11.0.0.35:9200/index/fulltext/2 -H 'Content-Type: application/json' -d'
{"content":"公安部:各地校车将享最高路权"}
'
curl -XPOST http://11.0.0.35:9200/index/fulltext/3 -H 'Content-Type: application/json' -d'
{"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船"}
'
curl -XPOST http://11.0.0.35:9200/index/fulltext/4 -H 'Content-Type: application/json' -d'
{"content":"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"}
'
curl -XPOST http://11.0.0.35:9200/index/fulltext/_search -H 'Content-Type: application/json' -d'
{
"query" : { "match" : { "content" : "中国" }},
"highlight" : {
"pre_tags" : ["<tag1>", "<tag2>"],
"post_tags" : ["</tag1>", "</tag2>"],
"fields" : {
"content" : {}
}
}
}
'
{"took":16,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":2,"max_score":0.6489038,"hits":[{"_index":"index","_type":"fulltext","_id":"4","_score":0.6489038,"_source":
{"content":"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"}
,"highlight":{"content":["<tag1>中国</tag1>驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"]}},{"_index":"index","_type":"fulltext","_id":"3","_score":0.2876821,"_source":
{"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船"}
,"highlight":{"content":["中韩渔警冲突调查:韩警平均每天扣1艘<tag1>中国</tag1>渔船"]}}]}}
3、java的jvm参数修改config下面的jvm.options即可。
网友评论