How can we manually manipulate score field in Elasticsearch -


i working on current scenario there need boost few documents in case if there particular text search. scenario is, have set of documents have term query based on particular keyword , catch here is. let's search keyword test fetch 100 records requirement says few docs should come top result, irrespective of there weightage , other criteria. how can achieve elasticsearch, suggestion , ideas welcome.

you can control relevance scripts. take at: https://www.elastic.co/guide/en/elasticsearch/guide/current/script-score.html

this example using groovy:

price  = doc['price'].value  margin = doc['margin'].value   if (price < threshold) {    return price * margin / target } return price * (1 - discount) * margin / target  

so, in pseudo-code like:

if (word == 'test') {    return score * n } return score 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -