If you did the script score path, don't you run into performance issues?  I 
would think, running say thousands of queries like that would probably not 
be performant.
unless I am missing something.

On Sunday, December 21, 2014 8:01:06 PM UTC-8, vineeth mohan wrote:
>
> Hello , 
>
> My advice would be to use the script function type. Inside it you can 
> access _score which is the score given by the query and the value of the 
> field. Mix them together in whatever logic you want. 
>
> Thanks
>             Vineeth
>
> On Thu, Dec 11, 2014 at 7:28 PM, hespoddi <[email protected] 
> <javascript:>> wrote:
>
>> Hi all,
>>
>> We'd like to combine the query score with our own custom trending score 
>> for a given document. Currently, our query looks like:
>>
>> {
>>     "query": {
>>         "filtered": {
>>             "filter": {
>>                 "and": [
>>                     {
>>                         "range": {
>>                             "trendingScore": {
>>                                 "gt": 0.0
>>                             }
>>                         }
>>                     }
>>                 ]
>>             }, 
>>             "query": {
>>                 "function_score": {
>>                     "functions": [
>>                         {
>>                             "field_value_factor": {
>>                                 "field": "trendingScore"
>>                             }
>>                         }
>>                     ], 
>>                     "query": {
>>                         "bool": {
>>                             "minimum_should_match": 1, 
>>                             "should": [
>>                                 {
>>                                     "match_phrase": {
>>                                         "title": {
>>                                             "boost": 1.5, 
>>                                             "query": "<phrase>"
>>                                         }
>>                                     }
>>                                 }, 
>>                                 {
>>                                     "match_phrase": {
>>                                         "content": {
>>                                             "boost": 1.0, 
>>                                             "query": "<phrase>"
>>                                         }
>>                                     }
>>                                 }
>>                             ]
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>>     }
>> }
>>
>> So, this query seems to do want we want: it multiples the query score for 
>> document with our custom trending score (stored on the "trendingScore" 
>> field). The problem is that the trending score, in many cases, overwhelms 
>> the query score. Thus, documents with very low relevancy, but very high 
>> trending, are at the top of our results. Ideally, we'd filter the query to 
>> only return the top N percentage of documents that matched, but I don't 
>> think that's possible. We've looked at the min_score parameter for queries 
>> as well, but I don't know what a "good" value would be for this. 
>>
>> Does anyone have any ideas on the best way to solve this problem? Thank 
>> you ahead of time!
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/7bc5f7ed-4021-4044-bde0-a9e0f538e213%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/7bc5f7ed-4021-4044-bde0-a9e0f538e213%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/72359b37-a130-4984-a329-f1dff43848d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to