问题
My elasticsearch cluster health status is Yellow.
Does it mean that I may get partial results?
I am using amazon elastic instance and the summary on cluster health tab looks like this...
Number of nodes
1
Number of data nodes
1
Active primary shards
206
Active shards
206
Unassigned shards
205
I will like to know how do I change the status from Yellow to Green
回答1:
Cluster health yellow means one or more replicas shards are not allocated and elasticsearch query goes either to primary or replica shards to get the search results.
More info on various health status as per this ES doc.
The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated.
As in this case, for some indices their replicas are not assigned to any data nodes, Elasticsearch has to query all the primary shards and you will not get the partial results, but the performance of your search results would suffer, as replicas shards are used to improve the search performance and high availability
More information on how replicas improve search latency can be found in tune search performance article of ebay section.
Q:- Coming to your second question, on how do I change the status from Yellow to Green.
Answer: You need to figure out the reason, why your problematic indices replicas are not assigned, is it because there are less no of data nodes as Elasticsearch doesn't allocate replicas on the same node where its primary shard is allocated or you have more replicas for these indices than the data nodes. In these cases, you can increase the data nodes or reduce the no of replicas nodes(which can be done dynamically.
回答2:
If you want to keep the replica shards then try to increase the nodes. Your replica shards are still unassigned and hence you get [Yellow] cluster status.
You can also reduce the number of replica shards but this will affect the search performance.
来源:https://stackoverflow.com/questions/60602840/partial-query-results-due-to-elasticsearch-cluster-health-yellow