My understanding of Constant Score Query in elasticsearch is that boost 
factor would be assigned as score for every matching query. The 
documentation<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html>
 says:

A query that wraps a filter or another query and simply returns a constant 
score equal to the query boost for every document in the filter.

However when I send this query:

 "query": {
  "constant_score": {
     "filter": {
        "term": {
           "source": "BBC"
        }
     },
     "boost": 3
   }
  },
 "fields": ["title", "source"]

all the matching documents are given a score of 1?! I cannot figure out 
what I am doing wrong, and had also tried with query instead of filter in 
constant_score.


I've also tried using Function Score Query 

 "query": {
      "function_score": {
         "query": {
            "term": {
               "source": "gdrive"
            }
         },
         "script_score": {
            "script": "3"
         }
      }
   },
   "fields": [
      "title",
      "source"
   ]

But the score is not set to 3, but to what seems to be the Lucene score for the 
document.

Any idea of what I am doing wrong?!

Thanks,

Ilija

-- 
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/d1189650-a38c-4de3-8c06-b91d7703ee39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to