March 4, 2022 . 1 MIN READ
bin/magento module:enable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch6,Magento_Elasticsearch7}
bin/magento module:disable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch6,Magento_Elasticsearch7}
This seems to work:
bin/magento config:set catalog/search/elasticsearch7_server_hostname some-hostname
bin/magento config:set catalog/search/elasticsearch7_server_port 12345
php bin/magento setup:install –search-engine=elasticsearch7 –elasticsearch-host=”cg-7950-elasticsearch.us-west-1.nxcli.net” –elasticsearch-port=26305
php bin/magento setup:upgrade
For Elastic Search 6: execute the below command.
php bin/magento setup:install –search-engine=elasticsearch6 –elasticsearch-host=”localhost” –elasticsearch-port=9200
for Elastic Search 7 (just update the version)
php bin/magento setup:install –search-engine=elasticsearch7 –elasticsearch-host=”localhost” –elasticsearch-port=9200
Reference:
https://magento.stackexchange.com/questions/330159/magento-2-4-1-disable-elasticsearch
https://www.mageplaza.com/kb/how-to-configure-elasticseach-in-magento-2.html