Thanks for your answer ! I have some followup questions
1. I wrote a custom script to return a constant score of 2.5. It works for
the following query
{
query : {
function_score: {
query:{
match_all:{}
},
script_score: {
lang:native,
script: constant-score
}
}
}
}
I would like to influence the ranking with few fields that are not stored
in the index (eg click data for keyword-documents). I have used custom
SearchComponent in Solr to implement similar functionality in the past. I
am wondering how can i achieve the same in ElasticSearch.
I know this
Yes, you can use the Function Score Query [1] in combination with a native
script written in java [2]. With the native script you can basically do
whatever you want, but be careful you can significantly impact your query
performance if you are not careful.
[1]
Thats great, thanks for your reply. This looks like a good solution for my
requirement ! Is this script applied in each shard ? I want to apply this
function to all the documents so that the Top N picked from each shard is
picked by my custom score.
Also, can you elaborate a little bit on be
Well, the scripts runs against all matching documents of the query so you
can do a match_all query [1] to have the logic applied to all your
documents. This is going to be expensive though, so try to filter out as
many documents as possible before applying the custom scoring. Maybe even
perform