Exact difference between "Query_string" query and "multi_match" query with cross_fields


(Prashant Agrawal) #1

Hi ES users,

While exploring the new release of ES 1.1.0 I came across with the release of cross_fields query in multi_match.
So is there any difference between "Query_string" query and "multi_match" query with cross_fields.

for ex:
if my query_string query is:
"query_string": {
"fields": [
"title",
"content"
],
"query": "mobile phones"

So it will search for mobile or phones in either of title or content. like the result will come as
{mobile in title | mobile in content | phones in title | phones in content}

Similarly for multi_match query with cross_fields:
{
"multi_match" : {
"query": "mobile phones",
"type": "cross_fields",
"fields": [ "title", "content" ]
}
}

So in this also the search result will be like:
{mobile in title | mobile in content | phones in title | phones in content}

So just let me know if my interpretation is wrong in any of the scenario. If not then what exactly is the difference between these two.


(Prashant Agrawal) #2

Any updates on the above query?


(Mark Harwood-2) #3

The first difference is that the match/multi-match query aims to avoid the
sorts of syntax errors that can occur when using query_string which
supports several special characters that act as operators that must be used
correctly or the query will fail to parse.

Given the simpler nature of the match/multi-match queries it is possible to
apply some smarter logic to ranking how the terms match in a multi-field
context.
Lucene has a natural tendency to rank the rarer elements in a query more
highly and you can probably see this effect in multi-field query_string
queries in the way it can favour bizarre interpretations of your search. As
an example, if searching firstName and lastName fields the search term
"John" will rank higher if found in the lastName field rather than the more
commonplace firstName field due to Lucene's "IDF" (Inverse Document
Frequency) ranking favouring the scarcity of lastName:John.
The new multi-match algorithm will instead attempt to favour the most
likely interpretation of each search term and so firstName:John should rank
higher than lastName:John.

Cheers
Mark

On Friday, March 28, 2014 5:50:21 AM UTC, Prashy wrote:

Hi ES users,

While exploring the new release of ES 1.1.0 I came across with the release
of cross_fields query in multi_match.
So is there any difference between "Query_string" query and "multi_match"
query with cross_fields.

for ex:
if my query_string query is:
"query_string": {
"fields": [
"title",
"content"
],
"query": "mobile phones"

So it will search for mobile or phones in either of title or content. like
the result will come as
{mobile in title | mobile in content | phones in title | phones in
content}

Similarly for multi_match query with cross_fields:
{
"multi_match" : {
"query": "mobile phones",
"type": "cross_fields",
"fields": [ "title", "content" ]
}
}

So in this also the search result will be like:
{mobile in title | mobile in content | phones in title | phones in
content}

So just let me know if my interpretation is wrong in any of the scenario.
If
not then what exactly is the difference between these two.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Exact-difference-between-Query-string-query-and-multi-match-query-with-cross-fields-tp4052982.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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/94c94379-2f62-49dd-97ac-b6c04765334e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4