-
BoostingBackEnd/Elasticsearch API 2025. 3. 23. 05:00반응형
Boosting은 문서의 관련성 점수를 조정하여, 특정 조건을 만족하는 문서의 중요성을 높이거나 낮출 수 있는 기능입니다.
Boosting Query
두 개의 쿼리를 결합하여 하나의 쿼리와 일치하는 문서의 관련성 점수를 높이고, 다른 쿼리와 일치하는 문서의 점수를 낮출 수 있습니다.
구성 요소
- positive: 반드시 일치해야 하는 쿼리입니다.
- negative: 일치하면 관련성 점수를 낮추는 쿼리입니다.
- negative_boost: 관련성 점수를 낮출 때 사용하는 배율입니다. 값은 0에서 1사이입니다.
GET /my_index/_search { "query": { "boosting": { "positive": { "match": { "text": "apple" } }, "negative": { "match": { "text": "pie" } }, "negative_boost": 0.5 } } }
- apple을 포함하는 문서의 관련성 점수를 높이고, pie를 포함하는 문서의 점수를 절반으로 낮춥니다.
Query-Time Boosting
쿼리 실행 시 특정 필드나 조건에 가중치를 부여하여, 관련성 점수를 조정하는 방법입니다.
GET /my_index/_search { "query": { "match": { "title": { "query": "quick brown fox", "boost": 2 } } } }
- title 필드에서 "quick brown fox"를 찾을 때 관련성 점수를 두 배로 높입니다.
반응형'BackEnd > Elasticsearch API' 카테고리의 다른 글
Join Query (0) 2025.03.29 Nested Query (0) 2025.03.23 Full Text Search (0) 2025.03.22 Search (0) 2025.03.20 Analyzer (0) 2025.03.18