2.X/2. Search in Depth 62

2-2-2. The match Query

The match query is the go-to query—the first query that you should reach for whenever you need to query any field. It is a high-level full-text query, meaning that it knows how to deal with both full-text fields and exact-value fields.match query는 어떤 field를 query할 때마다 만나야 하는 첫 번째 query이다. match query는, full-text field와 exact-value field 양쪽 모두를 처리하는 방법을 알고 있는, high-level full-text query 이다.That s..

2-2-3. Multiword Queries

If we could search for only one word at a time, full-text search would be pretty inflexible. Fortunately, the match query makes multiword queries just as simple:한번에 한 단어만을 검색할 수 있다면, full-text 검색은 아주 융통성 없는 검색일 것이다. 하지만, matchquery는 간단하게 여러 단어로 된 query를 만들 수 있다.GET /my_index/my_type/_search { "query": { "match": { "title": "BROWN DOG!" } } }COPY AS CURLVIEW IN SENSE The preceding query returns a..

2-2-4. Combining Queries

In Combining Filters we discussed how to use the bool filter to combine multiple filter clauses with and, or, and not logic. In query land, the bool query does a similar job but with one important difference.Combining Filters에서, 다수의 filter 절을 and, or, not 으로 조합하기 위해, bool filter를 사용하는 방법에 대해 이야기한 바 있다. query에서도, bool query는 비슷한 작용을 하지만, 한가지 중요한 차이점이 있다.Filters make a binary decision: should this..

2-3-5. How match Uses bool

By now, you have probably realized that multiword match queries simply wrap the generated termqueries in a bool query. With the default or operator, each term query is added as a should clause, so at least one clause must match. These two queries are equivalent:이제, 다중 단어 match query는, 생성된 term query를 단순히 bool query로 감싼 것이라는 것을 알게 되었을 것이다. 각 term query가, 기본인 or operator와 함께, should 절에 추가된다. 따라서, ..

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-2-7. Controlling Analysis

Queries can find only terms that actually exist in the inverted index, so it is important to ensure that the same analysis process is applied both to the document at index time, and to the query string at search time so that the terms in the query match the terms in the inverted index.query는 inverted index에 실제로 존재하는 단어만을 찾을 수 있다. 따라서 document를 index할할 때 적용되는 프로세스와, 검색 시 query string에 적용되는 프로세스가,..

2-2-8. Relevance Is Broken!

Before we move on to discussing more-complex queries in Multifield Search, let’s make a quick detour to explain why we created our test index with just one primary shard.Multifield Search에서, 더 복잡한 query에 대해 알아보기 전에, 하나의 primary shard만을 가진 test index를 생성한 이유를 설명하겠다.Every now and again a new user opens an issue claiming that sorting by relevance is broken and offering a short reproduction: the use..

2-3. Multifield Search

Queries are seldom simple one-clause match queries. We frequently need to search for the same or different query strings in one or more fields, which means that we need to be able to combine multiple query clauses and their relevance scores in a way that makes sense.query는 단순하게 match query 하나의 절로 이루어 지지는 않는다. 하나 이상의 field에 동일하거나 혹은 다른 query string으로 검색하는 경우가 자주 발생한다. 즉, 다중 query 절과 relevance sco..

2-3-01. Multiple Query Strings

The simplest multifield query to deal with is the one where we can map search terms to specific fields. If we know that War and Peace is the title, and Leo Tolstoy is the author, it is easy to write each of these conditions as a match clause and to combine them with a bool query:가장 간단한 다중 field query는, 특정 field에 검색 조건을 mapping 하는 것이다. War and Peace 가 title이고, Leo Tolstoy가 author 라는 것을 안다면, match..

2-3-02. Single Query String

The bool query is the mainstay of multiclause queries. It works well for many cases, especially when you are able to map different query strings to individual fields.bool query는 다중 절(multi-clause) query의 핵심이다. 그것은 대부분의 경우 잘 동작한다. 특히 개별 field에 다른 query string을 mapping한 경우에 잘 동작한다.The problem is that, these days, users expect to be able to type all of their search terms into a single field, and ex..