I have to implement below custom sort options

– Order: A to Z
– Order: Z to A
– Price: Low to High
– Price: High to Low

I have tried with the example given in link.
This is not working with elastic search. I am getting a message

We can't find products matching the selection.

Please help me if anyone has implemented this.

  • Did you find the solution? Commented Dec 31, 2020 at 8:36
  • Didn't get the exact solution but ended with adding some custom logic in toolbar.js to handle sorting. Commented Apr 8, 2021 at 19:01

1 Answer 1


Custom Sort with ElasticSearch in Magento issue can be fixed by following these simple steps:

  • Navigate to Stores->Attributes->Product in Admin.
  • Add New Attribute.
  • In Properties->Attribute Properties:
    • Add Default Label (Eg: Price: Low to High)
    • Select the Catalog Input Type for Store Owner (Eg: Price) (In other cases Text Field is enough).
  • In Properties->Advanced Attribute Properties:
    • Add Attribute Code (Eg: price_asc).
  • In Storefront Properties->Storefront Properties:
    • Select User for Sorting in Product Listing to Yes

Once done with the above steps run the following commands,

bin/magento indexer:reindex catalogsearch_fulltext

bin/magento indexer:reindex
  • 1
    You've just added a product attribute as an answer to creating a custom product sort order that works with Elastic Search...!? :/
    – zigojacko
    Commented Nov 25, 2020 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.