This one is a little tricky to explain, but here goes.
I have an index with mappings that look like this:
{
"mappings":{
"properties":{
"manufacturer":{
"type":"text",
"analyzer":"standard"
},
"product":{
"type":"text",
"analyzer":"standard"
}
}
}
}
And I have some documents that look like this:
[
{
"manufacturer":"foo bar",
"product":"baz by foo bar"
},
{
"manufacturer":"foo bar",
"product:":"something something something qux"
}
]
Lastly, I have a query that looks like this:
{
"query":{
"bool":{
"should":[
{
"match":{
"manufacturer":{
"query":"foo qux"
}
}
},
{
"match":{
"product":{
"query":"foo qux"
}
}
}
]
}
}
}
Running the query, the document with baz by foo bar
ranks higher than something something something qux
. I suspect the reason is because foo
matches both fields in the first document (and closer to the start of each field) where qux
matches one document, and farther towards the end of the field than foo
does. I'm guessing a bit there.
What I want to do is have something something something qux
rank higher, since it matches both tokens in the query (foo
and qux
) and not just one of the terms twice.
Thanks in advance.