jdk1.8 安装 yum install java-1.8.0-openjdk* -y
可能会报这个错误
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
解决方法:
adduser *** //添加用户
su 用户名
./elasticsearch
后台运行 ./elasticsearch -d
-
#查看自己端口的使用情况
-
netstat -alnp | grep 9200
在elasticsearch 的plugins 目录下,新建一个名为:ik 的文件夹,把上面解压的东西放到ik文件内
curl -XGET -H "Content-Type: application/json" "http://localhost:9200/
_analyze?pretty=true" -d'{"text":"公安部:各地校车将享最高路权"}';
curl -XGET -H "Content-Type: application/json" "http://localhost:9200/_analyze?pretty=true" -d'{"text":"公安部:各地校车将享最高路权","analyzer": "ik_max_word"}';
{
"query": {
"bool": {
"should": [
{ "match": {
"name": {
"query": "我",
"boost": 1.2
}}},
{ "match": {
"name": {
"query": "中华人民共和国",
"boost": 3
}}}
]
}
}
}
组合查询
参数1:must 必须匹配
参数2:must_not 必须不匹配
参数3:should 默认情况下,should语句一个都不要求匹配,只有一个特例:如果查询中没有must语句,那么至少要匹配一个should语句