Changing the Elasticsearch or OpenSearch port via CLI (Magento 2)

To configure the Elasticsearch port from the Magento 2 command line (CLI), use:

If you use OpenSearch, run this command instead:

This way, you do not need to sign in to Magento 2 admin to change the port.…