2016-07-16 4 views
0

나는 Elasticsearch의 모든 색인에 대해 전역 분석기를 설정하려고합니다.탄성 탐침 분석기 구성

이 라인은 elasticsearch.yaml에 추가됩니다 Elasticsearch를 다시 시작한 후

index.analysis.analyzer.ik.type: ik 
index.analysis.analyzer.default.type: ik 
index.analysis.analyzer.standard.type: ik 

,이 라인은 = 그럼 난 & 분석기 时间 URL http://localhost:9200/_analyze?text= 테스트 http://localhost:9200/_nodes/settings

index: { 
    analysis: { 
    analyzer: { 
     standard: { 
     type: "ik" 
     }, 
     default: { 
     type: "ik" 
     }, 
     ik: { 
     type: "ik" 
     } 
    } 
    } 
} 

에 IK

표시됩니다
{ 
    tokens: [ 
    { 
     token: "时间", 
     start_offset: 0, 
     end_offset: 2, 
     type: "CN_WORD", 
     position: 0 
    } 
    ] 
} 

IKAnalyzer가 활성화되어 있음을 보여줍니다. 그러나,이 http://localhost:9200/_analyze?text=时间&analyzer=standard 또는 http://localhost:9200/_analyze?text= 时间에 관해서, "표준"분석 결과가 반환됩니다 :

그래서
{ 
    tokens: [ 
    { 
     token: "时", 
     start_offset: 0, 
     end_offset: 1, 
     type: "<IDEOGRAPHIC>", 
     position: 0 
    }, 
    { 
     token: "间", 
     start_offset: 1, 
     end_offset: 2, 
     type: "<IDEOGRAPHIC>", 
     position: 1 
    } 
    ] 
} 

, 어떻게해야합니까?

답변

1

기본 분석기 설정은 http://localhost:9200/_analyze으로 수행하는 "테스트"요청이 아닌 실제 인덱싱 된 문서에 영향을줍니다. 색인에 문서를 몇 개 추가 한 다음 검색 결과가 예상대로 작동하는지 확인하십시오.