Skip to content

Magento2 ElasticSearch product attribute weight based on value

If there is a way to set product attribute weight depending on it’s value?

F.e. we have 2 attributes to search: name(weight=10) and description(weight=1)
So in search results we’ll have first results with search query in name and then other results with query in description.

The actual result we want to have:

  1. Display first results with search query in name where product type is simple
  2. Then display results with search query in name where product type is virtual
  3. And then all other results mixed whatever.