elasticsearch-7.11.1安装及使用小记
一、解决启动错误
- 解决启动报错 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
参考:https://blog.csdn.net/qq_43655835/article/details/104633359
查看进程拥有VMA(虚拟内存区域)数量 sysctl -a|grep vm.max_map_count
设置VMA,然后在 /etc/sysctl.conf文件最后添加一行: vm.max_map_count=262144
输入命令:sysctl -p立即生效
- 启动异常the default discovery settings are unsuitable for production use; at least...
(或者启动后一直打印warn信息master not discovered yet, this node has not previously joine...)
参考:https://blog.csdn.net/qq_46548855/article/details/107416818
修改配置文件 config/elasticsearch.yml,如下:
# --------------------------------- Discovery ----------------------------------
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
discovery.seed_hosts: ["192.168.0.1"]
# Bootstrap the cluster using an initial set of master-eligible nodes:
cluster.initial_master_nodes: ["192.168.0.1:9300"]
-
最新版本的ElasticSearch不支持head插件,可使用离线版本的crs插件,直接导入浏览器会报错,可以解压加载
将crs插件文件改成.zip并解压,通过扩展页面的“加载解压缩的扩展”选择解压的目录即可使用! -
Head插件通过IP无法访问,将config/elasticsearch.yml中Host配置修改
Net.Host修改为0.0.0.0 -
报max file descriptors [4096] for elasticsearch process is too low错误
解决办法:
确保非root账号打开文件数量也增大
1.打开/etc/security/limits.conf,在里面添加如下内容
* soft nofile 65536
* hard nofile 65536
其中*表示所有用户 nofile表示最大文件句柄数,表示能够打开的最大文件数目
2. 修改完成后推出用户ssh,重新登录即可
————————————————
原文链接:https://blog.csdn.net/jiahao1186/article/details/90235771
二、使用操作
- 删除索引
curl -XDELETE 'http://192.168.0.1:9200/index_name_*'
- 支持NOT查询
{
"query": {
"bool" : {
"must_not" : {
"term" : {
"name" : "Fred"
}
}
}
}
}
- 多字段必须全部匹配
{
"query": {
"bool": {
"must": [
{"match": {"name": "little strong"}},
{ "match": {"age": "28"}}
]
}
}
}