Querystring query doubt on multifield


(cyrilforce) #1

Hi,

I trying to form a query_string query to query two fields as below :

1)Query DISPLAY_NAME field and PERFORMER field whether contain "we are
one" :

{
"explain" : true,
"from" : 0,
"size" : 10,

      "query" : {
        "query_string" : {
           "fields" : [ "DISPLAY_NAME^6.0", "PERFORMER"  ],
          "query" : "\"we are one\"",            
          "use_dis_max" : true
        }
      }

}

Result returned one documents :

2)Query DISPLAY_NAME field whether contain "we are one" :

{
"explain" : true,
"from" : 0,
"size" : 10,

      "query" : {
        "query_string" : {
           "fields" : [ "DISPLAY_NAME^6.0" ],
          "query" : "\"we are one\"",         
          "use_dis_max" : true
        }
      }

}

Result returned 5 documents :

3) The mapping :

*4)The index settings : *

I wanted to know why it will returned different result because in the index
5 documents contain * "we are one"* in the *DISPLAY_NAME *field however
the first query 1) returned one document only.
How i could solve this problem ? Also noticed from the explain section
seems like the boosting is not applied.

What i wanted to achieve here is when i search *"we are one" *it should
return all the documents that *DISPLAY_NAME *or *PERFORMER *contains the
search text and sorted BY DISPLAY_NAME then only PERFORMER.

eg :

  1. DISPLAY_NAME : we are one
    PERFORMER : we are one

  2. DISPLAY_NAME : we are one
    PERFORMER : Jaclyn

  3. DISPLAY_NAME : we are one of the best
    PERFORMER : Victor

  4. DISPLAY_NAME : James
    PERFORMER : we are one

  5. DISPLAY_NAME : David
    PERFORMER : we are one in the world

Thanks.

--
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/2acdbee6-52e5-49ad-8491-efd9ed9617ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2