限制
数组字段,数组大小无限制。
文档大小限制:2gb
given that the default http.max_content_length is set to 100mb, elasticsearch will refuse to index any document that is larger than that. you might decide to increase that particular setting, but lucene still has a limit of about 2gb.
https://stackoverflow.com/questions/28841221/what-is-the-maximum-elasticsearch-document-size/28841656#28841656
https://www.elastic.co/guide/en/elasticsearch/reference/current/general-recommendations.html
单字段大小限制
未找到资料,感觉整个文档不超就好
推荐配置
模板参考配置
从es 5.x开始,索引级设置需要写在模板中,或者在创建索引时指定,我们把各个索引通用的配置写到了模板中,这个模板匹配全部的索引,并且具有最低的优先级,让用户定义的模板有更高的优先级,以覆盖这个模板中的配置。
{
"template": "*",
"order": 0,
"settings": {
"index.merge.policy.max_merged_segment": "2gb",
"index.merge.policy.segments_per_tier": "24",
"index.number_of_replicas": "1",
"index.number_of_shards": "24",
"index.optimize_auto_generated_id": "true",
"index.refresh_interval": "120s",
"index.translog.durability": "async",
"index.translog.flush_threshold_size": "1000mb",
"index.translog.sync_interval": "120s",
"index.unassigned.node_left.delayed_timeout": "5d"
}
}
避免热索引分片不均
默认情况下,es的分片均衡策略是尽量保持各个节点分片数量大致相同。但是当集群扩容时,新加入集群的节点没有分片,此时新创建的
索引分片会集中在新节点上,这导致新节点拥有太多热点数据,该节点可能会面临巨大的写入压力。因此,对于一个索引的全部分片,我们需要控制单个节点上存储的该索引的分片总数,使索引分片在节点上分布得更均匀一些。
例如,10个节点的集群,索引主分片数为5,副本数量为1,那么平均下来每个节点应该有(5×2)/10=1个分片,考虑到节点故障、分片迁
移的情况,可以设置节点分片总数为2:
curl --location --request put 'http://127.0.0.1:9200/myindex/_settings' \
--header 'content-type: application/json' \
--data '{
"index": {
"routing.allocation.total_shards_per_node": "2"
}
}'
发表评论