score 28

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-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-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-03. Best Fields

Imagine that we have a website that allows users to search blog posts, such as these two documents:사용자들이 블로그 포스트를 검색할 수 있는 website를 가지고 있다고 가정해 보자. 다음과 같이 2개의 document가 있다.PUT /my_index/my_type/1 { "title": "Quick brown rabbits", "body": "Brown rabbits are commonly seen." } PUT /my_index/my_type/2 { "title": "Keeping pets healthy", "body": "My quick brown fox eats rabbits on a regular basis." }C..

2-4-5. Proximity for Relevance

Although proximity queries are useful, the fact that they require all terms to be present can make them overly strict. It’s the same issue that we discussed in Controlling Precision in Full-Text Search: if six out of seven terms match, a document is probably relevant enough to be worth showing to the user, but the match_phrase query would exclude it.proximity query가 유용하지만, 모든 단어가 존재해야 한다는 사실은, 너..

2-5-2. prefix Query

To find all postcodes beginning with W1, we could use a simple prefix query:W1 로 시작하는 우편번호를 검색하기 위해, 간단한 prefix query를 사용할 수 있다.GET /my_index/address/_search { "query": { "prefix": { "postcode": "W1" } } }COPY AS CURLVIEW IN SENSE The prefix query is a low-level query that works at the term level. It doesn’t analyze the query string before searching. It assumes that you have passed it the exact ..

2-6. Controlling Relevance

Databases that deal purely in structured data (such as dates, numbers, and string enums) have it easy: they just have to check whether a document (or a row, in a relational database) matches the query.오직 구조화된 데이터(date, number, string enum)만을 다루는 데이터베이스는 쉽다. document(RDB에서 row)가 query에 일치하는지 여부만을 확인한다.While Boolean yes/no matches are an essential part of full-text search, they are not enough by t..