Since upgrading to Magento 2.4x and having to use ElasticSearch as default, I am unable to find a way to sort category products by newest (created_at). I have tried enabling used_in_sort_by for created_at but it does not order products corretly. I am using the following to sort products -
case 'new_arrivals':
$this->_collection
->getSelect()
->order('e.entity_id '. $this->getCurrentDirection());
break;
I can get price and name sorting to work fine but sort by created_at does not. I've also tried sort by entity_id which does not work also.