You must install Elasticsearch or OpenSearch before installing Adobe Commerce or Magento Open Source 2.4.0. See Search engine prerequisites for details.
Install sample data after Magento
The following topics discuss how to install optional sample data after you have already installed the Magento software. There is one additional step compared to pre-installation, which is to update the Magento database schema and data.