• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question elasticsearch docker issue

Miller

Basic Pleskian
I am using an elasticsearch:7.62 docker image for Magento 2.4.1 but I am facing an issue every few days that my products aren't showing on the front end with a message "We can't find products matching the selection."

in my logs I get

"[2020-11-17 10:54:50] main.CRITICAL: {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [magento2_product_1]","resource.type":"index_or_alias","resource.id":"magento2_product_1","index_uuid":"_na_","index":"magento2_product_1"}],"type":"index_not_found_exception","reason":"no such index [magento2_product_1]","resource.type":"index_or_alias","resource.id":"magento2_product_1","index_uuid":"_na_","index":"magento2_product_1"},"status":404} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\Missing404Exception(code: 404): {\"error\":{\"root_cause\":[{\"type\":\"index_not_found_exception\",\"reason\":\"no such index [magento2_product_1]\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"magento2_product_1\",\"index_uuid\":\"_na_\",\"index\":\"magento2_product_1\"}],\"type\":\"index_not_found_exception\",\"reason\":\"no such index [magento2_product_1]\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"magento2_product_1\",\"index_uuid\":\"_na_\",\"index\":\"magento2_product_1\"},\"status\":404} at /var/www/vhosts/mydomain.co.uk/httpdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:624)"} []"

Reindexing the products fixes the issue

The output of curl http://localhost:9299/_cluster/health?pretty

"cluster_name" : "docker-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 1,
"active_shards" : 1,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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
 
Are you running more than one Magento 2 website using same ElasticSearch Docker? If yes, Please Change the Catalog Search Prefix to something else other than magento2 in other websites then re-index.
 
I am bring this old thread I created back up because this has started happening again, same error message can happen on 2 stores at random times one elasticsearch v7.6.2 and the other elasticsearch 8.4.3. They have different mappings and container names, even disabling one of the sites wont fix the issue
 
In this case, Most probably your ElasticSearch dockers might be running out of ES_JAVA_OPTS Memory.

Check the ElasticSearch Docker log as root,

#docker logs --tail 100 -f [Doker-ID}

You can get the [Doker-ID} with #docker ps

Also check,

#curl -sS "localhost:9200/_cat/nodes?h=heap*&v"

If the ES_JAVA_OPTS Memory is the case, Add this to your "Environment variables" in Plesk docker settings,

ES_JAVA_OPTS | -Xms2g -Xmx2g -server

You can increase the 2g accordingly to your requirements.
 
In this case, Most probably your ElasticSearch dockers might be running out of ES_JAVA_OPTS Memory.

Check the ElasticSearch Docker log as root,

#docker logs --tail 100 -f [Doker-ID}

You can get the [Doker-ID} with #docker ps

Also check,

#curl -sS "localhost:9200/_cat/nodes?h=heap*&v"

If the ES_JAVA_OPTS Memory is the case, Add this to your "Environment variables" in Plesk docker settings,

ES_JAVA_OPTS | -Xms2g -Xmx2g -server

You can increase the 2g accordingly to your requirements.
Thanks for that, no memory errors but I may have made a rookie mistake here

The output of the 7.6.2

curl http://localhost:9299/_cluster/health?pretty
{
"cluster_name" : "docker-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 2,
"active_shards" : 2,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 2,
"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

and the 8.4.3
curl http://localhost:9232/_cluster/health?pretty
{
"cluster_name" : "docker-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 7,
"active_shards" : 7,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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" : 87.5

The cluster names are the same, do you think this could be the issue?
 
Same Cluster names should not be an issue. Please check if these dockers or the server has been restarted and causing this issue.
 
Same Cluster names should not be an issue. Please check if these dockers or the server has been restarted and causing this issue.
No restarts and it happens randomly, could be 3 times in a day or it could be fine for a week.

The only waning I have in the log is

{"@timestamp":"2023-09-22T00:51:14.710Z", "log.level": "WARN", "message":"invalid internal transport message format, got (3,0,0,2f), [Netty4TcpChannel{localAddress=/172.17.0.3:9300, remoteAddress=/194.165.16.73:65447, profile=default}], closing connection", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[56661d20c7bc][transport_worker][T#6]","log.logger":"org.elasticsearch.transport.TcpTransport","elasticsearch.cluster.uuid":"IuVB7ygIQ0yFxdBEQQkOMA","elasticsearch.node.id":"7D6zYyfdSuqy3WG93X21NQ","elasticsearch.node.name":"56661d20c7bc","elasticsearch.cluster.name":"docker-cluster"}
"
 
I am trying to get my head round the logs, I can see it creates a new index the deletes the old one

"INFO", "message":"[test_product_1_v37] creating index
"INFO", "message":"[test_product_1_v37/6rqzgA6YS6-E5fI0epcowg] create_mapping"
"INFO", "message":"[test_product_1_v36/e7kXBsl7Stu3T6km01SEeQ] deleting index"

So above its created test_product_1_v37, then the mapping and finally deletes test_product_1_v36

Now here its deleting the index without creating the new one first

{"@timestamp":"2023-09-23T23:23:20.824Z", "log.level": "INFO", "message":"[test_product_1_v37/6rqzgA6YS6-E5fI0epcowg] deleting index", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[56661d20c7bc][masterService#updateTask][T#1]","log.logger":"org.elasticsearch.cluster.metadata.MetadataDeleteIndexService","elasticsearch.cluster.uuid":"IuVB7ygIQ0yFxdBEQQkOMA","elasticsearch.node.id":"7D6zYyfdSuqy3WG93X21NQ","elasticsearch.node.name":"56661d20c7bc","elasticsearch.cluster.name":"docker-cluster"}

What triggers the creation and deletion of of the indexes?
 
I am using an elasticsearch:7.62 docker image for Magento 2.4.1 but I am facing an issue every few days that my products aren't showing on the front end with a message "We can't find products matching the selection."

in my logs I get

"[2020-11-17 10:54:50] main.CRITICAL: {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [magento2_product_1]","resource.type":"index_or_alias","resource.id":"magento2_product_1","index_uuid":"_na_","index":"magento2_product_1"}],"type":"index_not_found_exception","reason":"no such index [magento2_product_1]","resource.type":"index_or_alias","resource.id":"magento2_product_1","index_uuid":"_na_","index":"magento2_product_1"},"status":404} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\Missing404Exception(code: 404): {\"error\":{\"root_cause\":[{\"type\":\"index_not_found_exception\",\"reason\":\"no such index [magento2_product_1]\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"magento2_product_1\",\"index_uuid\":\"_na_\",\"index\":\"magento2_product_1\"}],\"type\":\"index_not_found_exception\",\"reason\":\"no such index [magento2_product_1]\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"magento2_product_1\",\"index_uuid\":\"_na_\",\"index\":\"magento2_product_1\"},\"status\":404} at /var/www/vhosts/mydomain.co.uk/httpdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:624)"} []"

Reindexing the products fixes the issue

The output of curl

"cluster_name" : "docker-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 1,
"active_shards" : 1,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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 Epson EcoTank ET-2710 [87/149] Checking and Cleaning the Print Head - Printer Buttons
Hello,

I created a new container based on elasticsearch and it worked fine but after a few minutes it seems that the container is limited on memory usage, got out of memory message on logs.

How can i specify memory to use for a specifi container ?

System : Red Hat Enterprise Linux Server release 7.4 (Maipo)
Docker version : Docker version 17.09.0-ce

Thank you
 
You can add this to increase the ES_JAVA_OPTS Memory,

ES_JAVA_OPTS | -Xms2g -Xmx2g or -Xms4g -Xmx4g, most of the time 2g should be enough. The screenshot is from a ElasticSearch 6.8.3.

Firefox_Screenshot_2023-10-12T02-15-28.378Z.png
 
Back
Top