How do I adjust Magento ≥ 2.4.6 to Elasticsearch 8?

Step 1

Remove the line:

Step 2

composer require magento/module-elasticsearch-8 --update-with-all-dependencies

experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/prepare/prerequisites.html?lang=en#upgrade-elasticsearch

Step 3

bin/magento module:enable Magento_Elasticsearch8

Step 4

bin/magento setup:upgrade
bin/magento cache:enable
rm -rf var/di var/generation generated/*
bin/magento setup:di:compile
rm -rf pub/static/*
bin/magento setup:static-content:deploy -f en_US <additional locales>

Step 5

bin/magento config:set catalog/search/engine elasticsearch8
bin/magento config:set catalog/search/elasticsearch8_index_prefix <your value>
bin/magento cache:clean

Step 6

bin/magento indexer:reindex
bin/magento cron:run --bootstrap=standaloneProcessStarted=1
bin/magento cache:clean