If a company or a person wants to relicense their open source project, either they need to get permission from all its contributors to relicense their contributions, or the contributors already signed a CLA that allows for relicensing, or the contributors' code is removed entirely.
The "free work from the community" either was contributed under the terms of a CLA that allows for relicensing, or members of the community all agreed to relicense their contributions, or that free work was removed entirely.
There’s a bit more community contribution that just “code”. I have never contributed code to elasticsearch, but I have co-founded the Berlin ES meetup, before elastic, the company, even was a thing. The group was for some time one of the largest around. For a while, I was one of the most active posters in their IRC channel, helping other users with whatever issues they’d have using ES. I signed no CLA, I received no money nor do I want any. But I contributed my time in the understanding that we’re all working on something that benefits both ourselves and the wider community. That implicit understanding is now gone.
The "free work from the community" either was contributed under the terms of a CLA that allows for relicensing, or members of the community all agreed to relicense their contributions, or that free work was removed entirely.