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]> 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].
> 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/CAGdPd5nkqQhECx%3DhqPtdApGLU1T06roOabeds%2Btr2yrB6pmxKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.