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


(Alex K) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/074ec987-379b-4591-a5dc-0d2b482d4ec8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2