Binh,

I'm getting _score as 1 by replicating the above query.

curl -XPUT 'http://localhost:9200/acqindex/' -d '{
     "settings" : {
        "index" : {
            "number_of_shards" : 1,
            "number_of_replicas" : 1,
            "analysis" : {
               "analyzer" : {
                  "str_search_analyzer" : {
                      "tokenizer" : "standard",
                      "filter" :
["lowercase","asciifolding","suggestions_shingle","edgengram"]
                   },
                   "str_index_analyzer" : {
                     "tokenizer" : "standard",
                     "filter" :
["lowercase","asciifolding","suggestions_shingle","edgengram"]
                 }
               },
               "filter" : {
                   "suggestions_shingle": {
                       "type": "shingle",
                       "min_shingle_size": 2,
                       "max_shingle_size": 5
                  },
                  "edgengram" : {
                      "type" : "edgeNGram",
                      "min_gram" : 2,
                      "max_gram" : 30,
                      "side"     : "front"
                  },
         "Length" : {
            "type" : "length",
            "min" : 3
         }
              }
          }
     }
  }
}'

 curl -XPUT 'localhost:9200/acqindex/acqidx/_mapping' -d'{
    "acqidx":{
        "_boost": {
            "name":"boostFactor",
            "null_value":3.0
        },
        "properties":{
            "text":{"type":"string",
                "search_analyzer" : "str_search_analyzer",
                "index_analyzer":"str_index_analyzer"
                },
            "po": {
                "type": "double",
                "boost": 4.0
                },
            "boostFactor": {
                "type": "double"
            }
        }
    }
}'

curl -XPUT 'localhost:9200/acqindex/acqidx/1' -d '{ text:"Hotels in
Hoscur",po:8.8,boostFactor:8.8 }',
 curl -XPUT 'localhost:9200/acqindex/acqidx/2' -d '{ text:"Hotels in
innsburg",po:8.9,boostFactor:8.9 }'
  curl -XPUT 'localhost:9200/acqindex/acqidx/5' -d '{ text:"Hotels in
delhi",po:9.0,boostFactor:9.0 }'
  curl -XPUT 'localhost:9200/acqindex/acqidx/3' -d '{ text:"Hotels in
ink",po:9.0001,boostFactor:9.0001 }'
  curl -XPUT 'localhost:9200/acqindex/acqidx/4' -d '{ text:"Hotels in
houston",po:9.0002,boostFactor:9.0002 }'
  curl -XPUT 'localhost:9200/acqindex/acqidx/6' -d '{ text:"Hotels in
darjeling",po:9.0001,boostFactor:9.0001 }'

curl -XGET localhost:9200/acqindex/_search&pretty=true&explain=true -d '{
        "query":{
                "custom_score": {
                        "query": {
                                "query_string" : {
                                        "query": "hotel in",
                                        "fields":["text^30"]
                                }
                        },
                        "script" : "_score * doc['po'].value"
                }
        }
}'

Any idea why is such a behaviour is observed. I know _boost should have
different parameter that's why using a different parameter. As you told
earlier if I want to use my "po" field in custom score query, I'll have to
remove that _boost segment. But I need _boost so that I can add document
boost to my docs. That's why checking with a small use case.

Please help !!!

Thanks




On Sat, Feb 1, 2014 at 2:09 AM, Mukul Gupta <mukulnit...@gmail.com> wrote:

> Binh,
>
> how can I add explain:true in that one ?
>
>
> On Sat, Feb 1, 2014 at 1:47 AM, Binh Ly <b...@hibalo.com> wrote:
>
>> Should be roughly like this:
>>
>> {
>>   "query": {
>>     "custom_score": {
>>       "query": {
>>         "query_string": {
>>           "query": "blah blah",
>>           "fields": [
>>             "text^30",
>>             "ad",
>>             "st",
>>             "cn",
>>             "co"
>>           ],
>>           "default_operator": "AND"
>>         }
>>       },
>>       "script": "_score * (doc['po'].empty ? 1 : doc['po'].value == 0.0 ?
>> 1 : doc['po'].value)"
>>     }
>>   }
>> }
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/07ae02b5-39d9-410d-892e-8ff366de515c%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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAAVTvp6anHtDAnj2AkkbADUEqDt7J7_5XWQPJp6xP9t9G1F0ng%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to