索引狀態顯示為yellow的原因分析
基本的分片可用,但是備份不可用(或者是沒有備份); 這種情況Elasticsearch集群所有的主分片已經分片了,但至少還有一個副本是缺失的。不會有數據丟失,所以搜索結果依然是完整的。不過,你的高可用性在某種程度上被弱化。如果 更多的 分片消失,你就會丟數據了。把 yellow 想象成一個需要及時調查的警告。
解決方案
創建索引模版,指定默認的分片數及副本數,這樣在之后同樣引用該索引模版的索引將自動使用該設置,無需每次都手動設置每個索引的分片數和副本數,一勞永逸
curl --location --request PUT 'http://127.0.0.1:9200/_template/template_http_request_record' \
--header 'Authorization: Basic xxxxxxx==' \
--header 'Content-Type: application/json' \
--data-raw '{
"index_patterns": [
"record-*"
],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'
record_*:作用於所有以record_開頭的索引number_of_shards:分片數number_of_replicas:副本數
最終效果

https://www.cnblogs.com/gangdou/p/10724674.html
https://www.cnblogs.com/kevingrace/p/10671063.html
