function_score 6

v2.0-06. Query DSL changes

Queries and filters mergededitQueries and filters have been merged — all filter clauses are now query clauses. Instead, query clauses can now be used in query context or in filter context:query와 filter는 통합되었다. 모든 filter절은 이제 query절이다. 대신, 이제 query절은 query context 나 filter context 에서 사용된다.Query contextA query used in query context will calculate relevance scores and will not be cacheable. Query c..

2-3-6. Boosting Query Clauses

Of course, the bool query isn’t restricted to combining simple one-word match queries. It can combine any other query, including other bool queries. It is commonly used to fine-tune the relevance _score for each document by combining the scores from several distinct queries.물론, bool query는, 간단한 단일 단어(one-word) match query를 조합하는데 있어, 제한이 없다. 다른 bool query는 물론이고, 다른 어떤 query와도 조합할 수 있다. 여러 별개의 que..

2-6-07. function_score Query

The function_score query is the ultimate tool for taking control of the scoring process. It allows you to apply a function to each document that matches the main query in order to alter or completely replace the original query _score.The function_score query는 score 계산 프로세스를 제어할 수 있는 최고의 도구이다. 원래 query의 _score 를 변경하거나, 완전히 대체하기 위하여, query에 일치하는 각 document에 function을 적용할 수 있다.In fact, you can appl..

2-6-08. Boosting by Popularity

Imagine that we have a website that hosts blog posts and enables users to vote for the blog posts that they like. We would like more-popular posts to appear higher in the results list, but still have the full-text score as the main relevance driver. We can do this easily by storing the number of votes with each blog post:사용자들이 자기가 좋아하는 블로그 게시물에 투표할 수 있는 기능이 있는 website를 가정해 보자. 결과 목록에서 더 높게 나타나는 ..

2-6-09. Boosting Filtered Subsets

Let’s return to the problem that we were dealing with in Ignoring TF/IDF, where we wanted to scorevacation homes by the number of features that each home possesses. We ended that section by wishing for a way to use cached filters to affect the score, and with the function_score query we can do just that.Ignoring TF/IDF에서 다루었던 문제로 돌아가 보면, 여기에서는 각 여름용 별장이 가지고 있는 기능의 수로, 별장에 score를 계산하려 했다. score에 ..

2-6-13. Scoring with Scripts

Finally, if none of the function_score's built-in functions suffice, you can implement the logic that you need with a script, using the script_score function.마지막으로, function_score 의 내장 함수 어느 것도 충분하지 않다면, script_score function을 사용하여, script로 필요한 logic을 구현할 수 있다.For an example, let’s say that we want to factor our profit margin into the relevance calculation. In our business, the profit margin dep..