match query vs query string

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

match query vs query string

paul
Hi ,

I am testing the below two queries but it gives different results

Query 1:
......./university/_search?q=name:Massachusetts%20Insti&fields=name

Query 2:
{"size": 10, 
    "fields": [
       "name"
    ],
    "query": {
       "match": {
          "name": {
              "query": "Massachusetts Insti"
            }
          }
    }

I believe space between the words is causing problem , how to represent the query string in Query 2 in Query 1 i tries "+: "%20" for representing spaces.

Regards
Avinash

--
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/df824353-2a8a-4bb9-82b8-ac377f78fdc8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: match query vs query string

Johan Rask
Hi,

You have to supply the name of the field for both words.

name:Massachusetts name:Insti , Otherwise it will search for Insti in your defaul search field.

....../university/_search?q=name:Massachusetts%20name:Insti&fields=name

The match query does this for you.

Regards /Johan


Den fredagen den 24:e januari 2014 kl. 07:02:53 UTC+1 skrev paul:
Hi ,

I am testing the below two queries but it gives different results

Query 1:
......./university/_search?q=name:Massachusetts%20Insti&fields=name

Query 2:
{"size": 10, 
    "fields": [
       "name"
    ],
    "query": {
       "match": {
          "name": {
              "query": "Massachusetts Insti"
            }
          }
    }

I believe space between the words is causing problem , how to represent the query string in Query 2 in Query 1 i tries "+: "%20" for representing spaces.

Regards
Avinash

--
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/1388fcd8-b188-44d4-acd5-925175b46849%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: match query vs query string

paul
thank Johan you will try it.

-paul


On Fri, Jan 24, 2014 at 1:49 PM, Johan Rask <[hidden email]> wrote:
Hi,

You have to supply the name of the field for both words.

name:Massachusetts name:Insti , Otherwise it will search for Insti in your defaul search field.

....../university/_search?q=name:Massachusetts%20name:Insti&fields=name

The match query does this for you.

Regards /Johan


Den fredagen den 24:e januari 2014 kl. 07:02:53 UTC+1 skrev paul:
Hi ,

I am testing the below two queries but it gives different results

Query 1:
......./university/_search?q=name:Massachusetts%20Insti&fields=name

Query 2:
{"size": 10, 
    "fields": [
       "name"
    ],
    "query": {
       "match": {
          "name": {
              "query": "Massachusetts Insti"
            }
          }
    }

I believe space between the words is causing problem , how to represent the query string in Query 2 in Query 1 i tries "+: "%20" for representing spaces.

Regards
Avinash

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/Lx083-eHwoM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1388fcd8-b188-44d4-acd5-925175b46849%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
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/CAO066G1jz6UFpZO1OvkGQtMx8tp7ij-FB4F18wkXciCoZ8OG1g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.