2.X/2. Search in Depth 62

2-6-04. Manipulating Relevance with Query Structure

The Elasticsearch query DSL is immensely flexible. You can move individual query clauses up and down the query hierarchy to make a clause more or less important. For instance, imagine the following query:Elasticsearch의 query DSL은 매우 유연하다. 개별 query 절을, 절의 중요도에 따라, query 계층 구조의 위아래로 옮길 수 있다. 예를 들어, 아래 query를 가정해 보자.quick OR brown OR red OR foxWe could write this as a bool query with all terms at t..

2-6-05. Not Quite Not

A search on the Internet for "Apple" is likely to return results about the company, the fruit, and various recipes. We could try to narrow it down to just the company by excluding words like pie, tart, crumble, and tree, using a must_not clause in a bool query:인터넷에서 "Apple" 을 검색하면, 회사(company), 과일(fruit) 그리고 다양한 조리법(recipes)에 대한 결과를 반환할 것이다. bool query에서 must_not 절을 사용하여, pie, tart, crumble, 그리고..

2-6-06. Ignoring TF/IDF

Sometimes we just don’t care about TF/IDF. All we want to know is that a certain word appears in a field. Perhaps we are searching for a vacation home and we want to find houses that have as many of these features as possible:TF/IDF에 관계없이, 어떤 field에 특정 단어가 나타나는지 알고 싶을 경우가 있다. 휴가용 별장을 검색하고 있고, 가능한 한 많은 기능(wifi, 정원, 풀장 등)을 가진 집을 찾고 있다면 말이다.WiFiGardenPoolThe vacation home documents look something l..

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-11. The Closer, The Better

Many variables could influence the user’s choice of vacation home. Maybe she would like to be close to the center of town, but perhaps would be willing to settle for a place that is a bit farther from the center if the price is low enough. Perhaps the reverse is true: she would be willing to pay more for the best location.사용자의 여름 별장 선택에 영향을 줄 수 있는 많은 변수가 있다. 도시의 중심에 가깝게 있고 싶겠지만, 가격이 충분히 낮다면, 도심에..

2-6-12. Understanding the price Clause

The price clause is a little trickier. The user’s preferred price is anything up to £100, but this example sets the origin to £50. Prices can’t be negative, but the lower they are, the better. Really, any price between £0 and £100 should be considered optimal.price 절은 약간 교묘하다. 사용자의 선호 가격은 £100 이하이다. 그러나, 이 예제에서 origin은 £50으로 설정되어 있다. 가격은 –(negative)가 될 수 없다. 그러나 낮을수록 더 좋아한다. 실제로 £0과 £100 사이의 모든 ..

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..