in all editions of sonarqube, elasticsearch is bundled and a hard dependency of the application. elasticsearch is managed by sonarqube and you do not need to take care about it from an administrative point of view.
The database question is unrelated to elasticsearch tho. in the getting started command you are utilizing the embedded h2 database as persistent layer, while in the example docker-compose file we reference a real database for the persistent layer (postgresql).
The h2 database should really only be used to evaluate sonarqube as it is not supported for production use.
if you just want to try out sonarqube, yes but if you really want to deploy it, No. vm.max_map_count = 524288 is there to fulfill the requirements of sonarqube as documented here: Prerequisites and Overview | SonarQube Docs