# Searching Sorting

**URL:** <https://discuss.elastic.co/t/searching-sorting/204286>\
**Category:** Elasticsearch\
**Created:** [October 18, 2019, 10:10pm UTC](https://discuss.elastic.co/t/searching-sorting/204286 "2019-10-18T22:10:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bidzina\_Goginashvili](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bidzina_goginashvili/32/51114_2.png) [@Bidzina\_Goginashvili](https://discuss.elastic.co/u/Bidzina_Goginashvili)\
**Post date:** [October 18, 2019, 10:10pm UTC](https://discuss.elastic.co/t/searching-sorting/204286/1 "2019-10-18T22:10:12Z")

</div>

1)When I search for **iphone xs 256GB** it finds it succesfully, but not finds nothing on this case **iphone 256GB xs**  
2)When I search for **ACTIV A151-02 Fresh Line 6000mAh (green)** it only finds this **ACTIV A151-02 Fresh Line 6000mAh (green)** and doesn't find this **ACTIV A151-02 Fresh Line 6000mAh Pink** , **ACTIV A151-02 Fresh Line 6000mAh White** or this **ACTIV A151-02 Fresh Line 6000mAh white**.  
3)Also when I find for **iphone samsung** it can't find nothing  
In one word the full text needs some modifications what can I do?  
I know this is because of AND operator but I need it because of sorting you know...What can I do with this query? pls give me suggestions or help.

There is query...

> GET index/\_search  
> {  
> "from": 0,  
> "query": {  
> "query\_string": {  
> "fields": [  
> "name^5"  
> ],  
> "query": "iphone",  
> "default\_operator": "AND",  
> "type": "phrase\_prefix"  
> }  
> },  
> "size": 10,  
> "sort": [  
> {  
> "vendorCount": {  
> "order": "desc"  
> }  
> },  
> {  
> "viewStatistics": {  
> "order": "desc"  
> }  
> }  
> ],  
> "\_source": {  
> "includes": [  
> "id",  
> "name"  
> ]  
> }  
> }

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 19, 2019, 12:31am UTC](https://discuss.elastic.co/t/searching-sorting/204286/2 "2019-10-19T00:31:51Z")

</div>

Most likely it's because you are using a phrase prefix.  
You should maybe combine different queries within some bool / should clauses.

---

<div class="post-metadata">

**Author:** ![Bidzina\_Goginashvili](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bidzina_goginashvili/32/51114_2.png) [@Bidzina\_Goginashvili](https://discuss.elastic.co/u/Bidzina_Goginashvili)\
**Post date:** [October 19, 2019, 12:10pm UTC](https://discuss.elastic.co/t/searching-sorting/204286/3 "2019-10-19T12:10:14Z")

</div>

What should I use instead of phrase prefix. Nothing works for my cases... Why should queries? I only use them while filtering data.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 19, 2019, 12:28pm UTC](https://discuss.elastic.co/t/searching-sorting/204286/4 "2019-10-19T12:28:11Z")

</div>

I didn't say instead but in addition to.

Nothing related to your use case but here are some ideas that could help.

> <https://gist.github.com/dadoonet/5179ee72ecbf08f12f53d4bda1b76bab>

---

<div class="post-metadata">

**Author:** ![Bidzina\_Goginashvili](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bidzina_goginashvili/32/51114_2.png) [@Bidzina\_Goginashvili](https://discuss.elastic.co/u/Bidzina_Goginashvili)\
**Post date:** [October 19, 2019, 9:50pm UTC](https://discuss.elastic.co/t/searching-sorting/204286/5 "2019-10-19T21:50:32Z")

</div>

Thank you so much, appreciate your work... I will try best solution for my case...

---

<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:** [November 16, 2019, 9:50pm UTC](https://discuss.elastic.co/t/searching-sorting/204286/6 "2019-11-16T21:50:36Z")

</div>

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