Elasticsearch 6.7.0 status Yellow in Magento 2.3.1

I have an Ubuntu 18.04 system installed on a Digital Ocean server. I have installed the Magento 2.3.1 version. I have installed Java and Elasticsearch using the following commands:


sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get install -y oracle-java8-installer


wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt update
sudo apt install elasticsearch
Edit this file: /etc/elasticsearch/elasticsearch.yml and add this info: network.host: localhost
sudo systemctl daemon-reload
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

If I execute this command:

curl -XGET -H "Content-Type: application/json" http://localhost:9200/_cluster/health?pretty=true

This is the result:

"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 20,
"active_shards" : 20,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 20,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 50.0

The status is yellow and unassigned_shards is 20. How can I solve this problem?

The status is yellow because you have unassigned shards. The allocation explain API is normally a good way to explain why they are unassigned.

In this case you have one node, but I think your indices all have number_of_replicas: 1 (which is the default). The primary of each shard is assigned to your one node, but there is no other node to hold the replica. Either add a second node to your cluster, or set number_of_replicas: 0 on each index.

1 Like

Thank you very much for your reply. I am very new to Elasticsearch, could you tell me how I can solve this problem please?


See also https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html and https://www.elastic.co/guide/en/elasticsearch/reference/6.7/indices-templates.html

Thank you very much for your advice. Could you tell me a website where you can read the difference between creating a new node and putting each index to zero? (Or if you can explain it to me I would appreciate it)

Is it possible that the slowness of my website is due to this? (my website is a Magento 2)

Sure, there's loads of introductory material linked from the pages I've suggested:



It's unlikely that the yellow health status is the cause is your website's performance issues, however.

@DavidTurner Do you think this warning is easy to solve?

warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME

When I execute this order this is the result:

$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)


$ echo $JAVA_HOME

How can I solve this problem?

@DavidTurner I have been researching and I can not add a new node from the terminal, could you help me please?

Sure, if you cannot add a new node then the other alternative is to set number_of_replicas: 0 on all your indices. There's a link above about how to adjust the settings on an index, but here it is again:


For this, I used this sentence:

curl -XPUT "localhost:9200/*/_settings" -H 'Content-Type: application/json' -d' { "index" : { "number_of_replicas":0 } '

But I received this error:

{"error":{"root_cause":[{"type":"json_e_o_f_exception","reason":"Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@3f073516; line: 1, column: 2])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@3f073516; line: 1, column: 87]"}],"type":"json_e_o_f_exception","reason":"Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@3f073516; line: 1, column: 2])\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@3f073516; line: 1, column: 87]"},"status":500}

The key part of the error message is expected close marker for Object: your JSON is syntactically invalid because it is missing a closing brace. Try this:

{ "index" : { "number_of_replicas":0 }}

1 Like

It has been fixed! Thank you so much for your help! One more question, Magento now needs to use Elasticsearch to manage the database. I have Elasticsearch installed on the same server as Magento. Could you tell me if this is a good practice?

It's not unusual for a small system. I don't know anything about Magento, I'm afraid, but as a general principle you'll have to be aware of a couple of issues:

  • you only have the resources of a single server available to do all the work. Perhaps this is enough, perhaps it's not - it depends on how heavily you're using it.

  • you only have one Elasticsearch node. If it breaks (e.g. the disk becomes corrupt) then you will lose data.

How can a node be broken and data lost?

Disks are one of the least reliable components of a server, and they fail (or silently corrupt data) with surprising frequency. A good quality disk might be within spec if it only corrupts one in every 10^14 bits, but that's only 11TB of data, and some people report much higher error rates.

My disk is SSD, this helps the node not break?

No, SSDs are also not 100% reliable, and their reliability degrades over time.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.