# How sorting result for ecommerce

**URL:** <https://discuss.elastic.co/t/how-sorting-result-for-ecommerce/284612>\
**Category:** Elasticsearch\
**Created:** [September 20, 2021, 10:12am UTC](https://discuss.elastic.co/t/how-sorting-result-for-ecommerce/284612 "2021-09-20T10:12:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![script](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/script/32/94776_2.png) [@script](https://discuss.elastic.co/u/script)\
**Post date:** [September 20, 2021, 10:12am UTC](https://discuss.elastic.co/t/how-sorting-result-for-ecommerce/284612/1 "2021-09-20T10:12:55Z")

</div>

Hi to all, i don't understan what is the best solution for sort search result in my ecommerce. I have a index 'product', with same filed. The field 'name' have this mapping:  
`['type' => 'text', 'term_vector' => 'with_positions']`  
I have same product, for example:

- Apple Iphone 11 6/64GB Black
- Flip cover for Apple iphone 11
- Screen protector for Apple iphone 11
- Apple Iphone 11 6/128GB White

If i search for query 'Apple iphone 11', i need results in this order:

1. Apple Iphone 11 6/64GB Black
2. Apple Iphone 11 6/128GB White
3. Flip cover for Apple iphone 11
4. Screen protector for Apple iphone 11

But if i use match, match\_phrase, multi\_match, i have result in different order. I think is important that the query, if is situated in the first part of product name, give a better rate to the item, but in what way i can have this result?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 18, 2021, 10:13am UTC](https://discuss.elastic.co/t/how-sorting-result-for-ecommerce/284612/2 "2021-10-18T10:13:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
