# Make a autosuggest-search searching in realtime doesn't work properly

**URL:** <https://discuss.elastic.co/t/make-a-autosuggest-search-searching-in-realtime-doesnt-work-properly/16769>\
**Category:** Elasticsearch\
**Created:** [April 2, 2014, 2:08pm UTC](https://discuss.elastic.co/t/make-a-autosuggest-search-searching-in-realtime-doesnt-work-properly/16769 "2014-04-02T14:08:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_K](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Alex\_K](https://discuss.elastic.co/u/Alex_K)\
**Post date:** [April 2, 2014, 2:08pm UTC](https://discuss.elastic.co/t/make-a-autosuggest-search-searching-in-realtime-doesnt-work-properly/16769/1 "2014-04-02T14:08:44Z")

</div>

Hi there,

I have the following Request I send to ES:

{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"should": [  
{  
"multi\_match": {  
"query": "socks purple",  
"fields": [  
"TITLE"  
],  
"type": "phrase\_prefix"  
}  
},  
{  
"multi\_match": {  
"query": "socks purple",  
"fields": [  
"TITLE"  
],  
}  
}  
]  
}  
},  
"filter": {  
"and": [  
{  
"terms": {  
"ACTIVE": [  
1  
]  
}  
}  
]  
}  
}  
},  
"size": 7  
}

Now, the first multi\_match gives me good results, when I input the words I  
search in the correct manner (e.g. "Purple Socks").  
But when I enter it in a 'wrong' way (e.g. "Socks Purple") it doesn't find  
anything.  
A colleague of mine said I could try using a second multi\_match.  
I have not much knowledge of ES, almost all of the above was already there,  
I just extended the code with the second multimatch.  
But now there is the problem, that if I input "socks" it gives me all  
matches for socks.....now when I continue to enter "purple", it gives me  
not just purple socks, but everything matching purple (although I would  
expect only purple socks)  
Anyone knows what the problem here is?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/074ec987-379b-4591-a5dc-0d2b482d4ec8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/074ec987-379b-4591-a5dc-0d2b482d4ec8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:38am UTC](https://discuss.elastic.co/t/make-a-autosuggest-search-searching-in-realtime-doesnt-work-properly/16769/2 "2017-07-06T01:38:46Z")

</div>

Closed on July 6, 2017, 1:38am UTC


