2017-02-07 5 views
0

를 수정하지 I가 내 구문 SUGGESTER에 다음 매핑 :구문 SUGGESTER Elasticsearch는 두 단어

{ 
    "settings": { 
     "analysis": { 
     "analyzer": { 
      "suggests_analyzer": { 
       "tokenizer": "standard", 
       "filter": [ 
        "lowercase", 
        "asciifolding", 
        "shingle_filter" 
       ], 
       "type": "custom" 
      } 
     }, 
     "filter": { 
      "shingle_filter": { 
       "min_shingle_size": 2, 
       "max_shingle_size": 6, 
       "type": "shingle" 
      } 
     } 
     } 
    }, 
    "mappings": { 
     "sample_data": { 
     "properties": { 
      "name": { 
       "type": "string", 
       "analyzer": "suggests_analyzer" 
      } 
     } 
     } 
    } 
} 

나는 "폐암", "대장 암"이, 내 인덱스에서 인덱스 "유방암". 하지만 내가 한 단어를 mispelt mispelt 쿼리에 대한 쿼리 때 "lhng cancar"콜트 기능을 사용할 때 0 결과를 반환합니다. 내 샘플 쿼리는 다음과 같습니다.

{ 
    "suggest": { 
     "text": "lhng cancar", 
     "simple_phrase": { 
     "phrase": { 
      "field": "name", 
      "size": 5, 
      "real_word_error_likelihood": 0.95, 
      "max_errors": 0.5, 
      "direct_generator": [ 
       { 
        "field": "name", 
        "suggest_mode": "always", 
        "size": 5 

       } 
      ], 
      "collate": { 
       "query": { 
        "inline": { 
        "match_phrase": { 
         "{{field_name}}": "{{suggestion}}" 
        } 
        } 
       }, 
       "params": { 
        "field_name": "name" 
       }, 
       "prune": false 
      } 
     } 
     } 
    }, 
    "size": 0 
} 

는 위의 질의에 대한 응답은 다음과 같습니다

{ 
    "took": 17, 
    "timed_out": false, 
    "_shards": { 
     "total": 5, 
     "successful": 5, 
     "failed": 0 
    }, 
    "hits": { 
     "total": 1868381, 
     "max_score": 0, 
     "hits": [] 
    }, 
    "suggest": { 
     "simple_phrase": [ 
     { 
      "text": "lhng cancar", 
      "offset": 0, 
      "length": 11, 
      "options": [] 
     } 
     ] 
    } 
} 

어떤 변경이 제안에서 "폐암"으로 예상 된 결과를 얻을 수 있도록 쿼리에서 어떻게해야합니까?

+0

[ElasticSearch - 구문 검색 자] 가능한 복제본 (https://stackoverflow.com/questions/32011110/elasticsearch-phrase-suggestor) – cbuchart

답변

1

주어진다.