Zend certified PHP/Magento developer

Magento 2 – list products out of stock at the end with ELASTIC SEARCH

I need to show out of stock products on at the end of listings using ElasticSearch on Magento 2.4.*.

I was able to order without ElasticSearch, but once I enable ElasticSearch it won’t work.

It feels like something applies order after the collection orders are set.

Just to let you know:

  • This cannot be done using an attribute and enabling sorting because it will be added to any frontend listing at the same time other order is applied;

Thanks!!!!