Installed Magento 2.4.3, upon adding an initial product receive the following error.
The stock item was unable to be saved. Please try again. {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0)
When performing an re-index of the indices the Catalog index throws a 405 Not Allowed.
Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:00 Category Products index has been rebuilt successfully in 00:00:00 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:00 Stock index has been rebuilt successfully in 00:00:00 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:00 Catalog Search index process error during indexation process: <html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.18.0 (Ubuntu)</center> </body> </html>
Contents of var/log/exception.log
[2021-10-27 02:27:33] main.CRITICAL: The stock item was unable to be saved. Please try again. {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): The stock item was unable to be saved. Please try again. at /usr/share/magento2/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:196, Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 405): <html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.18.0 (Ubuntu)</center> </body> </html> at /usr/share/magento2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:675)"} [] [2021-10-27 02:31:57] main.CRITICAL: <html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.18.0 (Ubuntu)</center> </body> </html> {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 405): <html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.18.0 (Ubuntu)</center> </body> </html> at /usr/share/magento2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:675)"} []
Verifying Elasticsearch cluster status.
# curl http://localhost:9200/_cluster/health {"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"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":100.0}
I have searched the forums and Google, but am unable to find a resolution. Any help would be greatly appreciated.
- Please change all indexer as Update by Schedule mode in system-> index management
- Review if you have a named “default” stock source on your admin. Under Stores > Inventory > Sources. If you don’t have this one, let’s create it. If the problem persist, try running the following commands below:
rm -rf generated/* php bin/magento indexer:reset php bin/magento indexer:reindex php bin/magento cache:clean
/etc/apache2/sites-available/elasticsearch.conf
=> paste this code
<VirtualHost *:8080>
ProxyPass "/" "http://localhost:9200/"
ProxyPassReverse "/" "http://localhost:9200/"
</VirtualHost>
sudo a2ensite elasticsearch.conf
Visit this link for detailed clarification
https://www.magetop.com/blog/install-magento-2-4-2-on-ubuntu/#5_Install_Elasticsearch
bin/magento indexer:reset catalogsearch_fulltext; bin/magento indexer:info bin/magento indexer:reindex
@dharmesh wrote:/etc/apache2/sites-available/elasticsearch.conf
=> paste this code
<VirtualHost *:8080>
ProxyPass "/" "http://localhost:9200/"
ProxyPassReverse "/" "http://localhost:9200/"
</VirtualHost>
sudo a2ensite elasticsearch.conf
Visit this link for detailed clarification
https://www.magetop.com/blog/install-magento-2-4-2-on-ubuntu/#5_Install_Elasticsearch
Thanks issue resolved. Can we use same code for clear the post index issues?