elasticsearch – Magento 2.4 – Elastic Search Out of Stock products at end of Product Listings

I need to display Out of Stock products at end of the Listing in category page. I have overided the SetCollection method in Toolbar.php using around method(upto magento 2.3.5 without elasticsearch it worked fine). But it is not working with Elastic Search.

 namespace VendorModulePluginProductProductList;

class Toolbar
 * Around Plugin to set the order collection based on sort type
 * @param MagentoCatalogBlockProductProductListToolbar $subject
 * @param Closure $proceed
 * @param MagentoFrameworkDataCollection $collection
 * @return MagentoCatalogBlockProductProductListToolbar
public function aroundSetCollection(
    MagentoCatalogBlockProductProductListToolbar $subject,
    Closure $proceed,
) {
    $currentOrder = $subject->getCurrentOrder();
    $currentDirection = $subject->getCurrentDirection();
    $result = $proceed($collection);
    $this->_collection = $collection;

    /* To Move out of stock product at the end */
    $orderBy = $subject->getCollection()->getSelect()->getPart(Zend_Db_Select::ORDER);
    $outOfStockOrderBy = array('is_salable DESC');


    return $result;


Is there any other way to fix that ?