es常见问题

1、TooManyClauses问题:

"caused_by":{"type":"too_many_clauses","reason":"maxClauseCount is set to 1024"}}}],

"caused_by":{"type":"query_shard_exception","reason":"failed to create query:

修改Elasticsearch的config文件夹中的elasticsearch.yml文件,添加行:

index.query.bool.max_clause_count: 10240

Elasticsearch5以上版本:

 indices.query.bool.max_clause_count: 10240

设置最大限制bool查询的条数。过多会导致性能比较慢。
或者查询时加入 "track_total_hits":true

2、“error” : “Content-Type header [application/x-www-form-urlencoded] is not supported”

这是由于官方指出:
CORS安全策略不会将application / json视为安全内容类型,因此浏览器会执行所谓的预检请求。
我们需要在上传时指定header信息即可

解决方式curl时加入 -H "Content-Type: application/json" 即可

curl -H "Content-Type: application/json" -X PUT 'localhost:9200/weather'

3.启动es时报错

  3.1、vi /etc/sysctl.conf

加入:

vm.max_map_count=655360

  加载参数

  sysctl -p

3.2、启动出现下列错误时

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [1024] for user [elastic] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[5]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

打开/etc/security/limits.conf,在里面添加如下内容

* soft nofile 65536

* hard nofile 65536

不行继续修改 /etc/security/limits.d/90-nproc.conf

* soft nproc 1024
将上面修改为:
* soft nproc 2048

 其中*表示所有用户  nofile表示最大文件句柄数,表示能够打开的最大文件数目

3.3、启动出现下列错误时

ERROR: [2] bootstrap checks failed
[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] mu

修改elasticsearch elasticsearch.yml文件加入:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

3.4、启动出现下列错误时

ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

修改elasticsearch.yml文件加入:

cluster.initial_master_nodes: ["node-1"]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值