field
의 필드와 동일한 analyzer
를 사용하여 입력된 문서에서 텍스트를 추출한다.tf-idf
가 가장 높은 상위 K개의 텀을 선택하여 분리형 쿼리를 생성한다.fields
의 필드는 text,keyword
타입이여야 함.GET index/_search
{
"track_total_hits": true,
"query": {
"more_like_this": {
"fields": ["description"],
"like": ["retractable start three"],
"min_term_freq": 1,
"max_query_terms": 25
}
},
"_source": [
"description"
]
}
- like에 입력된 텍스트를
analyzer
분석
(fields의 첫 필드인description
의analyzer
사용.)- 분석 결과 "retractable start three" -> [retractable retract start three] 를 가지게 된다.
- 분석 결과들 중 tf-idf와 지정한 옵션에 따라 검색할 상위 K개 term을 선택해(retractable retract..) 분리형 쿼리를 생성하고 검색한다.
1. like
2. unlike
3. fields
1. min_term_freq
예시.
"like" : "Retract Retract safety syringe with a soft piston",
"min_term_freq" : 2
2번 나오는 텀들을(Retract) term으로 선택된다.
2. max_query_terms
3. min_word_length
4. max_word_length
5. stop_words
6. analyzer
fields
의 첫 필드의 analyzer
를 사용하게 됨)7. include
예시.
GET index/_search
{
"query": {
"bool": {
"must": [
{
"more_like_this": {
"fields": ["description"],
"like": [
{
"_index": "index",
"_id": "123456789"
}
],
"min_term_freq": 1,
"max_query_terms": 3,
"include":true
}}]}},
"_source": [
"description"
]
} > 여기선 index의 123456789값은 검색되지 않는다.