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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Prashant Agrawal
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.




Reply | Threaded
Open this post in threaded view
|

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

Prashant Agrawal
Any updates on the above query?
Reply | Threaded
Open this post in threaded view
|

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

Mark Harwood-2
In reply to this post by Prashant Agrawal
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: <a href="http://elasticsearch-users.115913.n3.nabble.com/Exact-difference-between-Query-string-query-and-multi-match-query-with-cross-fields-tp4052982.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Felasticsearch-users.115913.n3.nabble.com%2FExact-difference-between-Query-string-query-and-multi-match-query-with-cross-fields-tp4052982.html\46sa\75D\46sntz\0751\46usg\75AFQjCNG9yInaHgVSscnVaYGy1HF-0y-kyA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Felasticsearch-users.115913.n3.nabble.com%2FExact-difference-between-Query-string-query-and-multi-match-query-with-cross-fields-tp4052982.html\46sa\75D\46sntz\0751\46usg\75AFQjCNG9yInaHgVSscnVaYGy1HF-0y-kyA';return true;">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 [hidden email].
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.