Korean Jaso Analyzer for Elasticsearch 7.16.2
$ sh gradlew clean build buildPluginZip
자동완성용 한글 자소분석기입니다. elasticsearch 7.16.2 에서 테스트 되었습니다
bin/elasticsearch-plugin install https://github.com/netcrazy/elasticsearch-jaso-analyzer/releases/download/v7.16.2/jaso-analyzer-plugin-7.16.2-plugin.zip
bin/elasticsearch-plugin remove jaso-analyzer
curl -XDELETE 'http://localhost:9200/jaso'
Korean Jaso Analyer 설정 및 인덱스 생성 (기본 자소검색용)
curl -XPUT -H 'Content-Type: application/json' localhost:9200/jaso/ -d '{
"settings": {
"index": {
"analysis": {
"filter": {
"suggest_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 50
}
},
"analyzer": {
"suggest_search_analyzer": {
"type": "custom",
"tokenizer": "jaso_tokenizer"
},
"suggest_index_analyzer": {
"type": "custom",
"tokenizer": "jaso_tokenizer",
"filter": [
"suggest_filter"
]
}
}
}
}
}
}'
Korean Jaso Analyer 설정 및 인덱스 생성 (한,영오타 및 초성토큰 추출이 필요할 때..)
curl -XPUT -H 'Content-Type: application/json' http://localhost:9200/jaso/ -d '{
"settings": {
"index": {
"analysis": {
"filter": {
"suggest_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 50
}
},
"tokenizer": {
"jaso_search_tokenizer": {
"type": "jaso_tokenizer",
"mistype": true,
"chosung": false
},
"jaso_index_tokenizer": {
"type": "jaso_tokenizer",
"mistype": true,
"chosung": true
}
},
"analyzer": {
"suggest_search_analyzer": {
"type": "custom",
"tokenizer": "jaso_search_tokenizer"
},
"suggest_index_analyzer": {
"type": "custom",
"tokenizer": "jaso_index_tokenizer",
"filter": [
"suggest_filter"
]
}
}
}
}
}
}'
curl -XPUT -H 'Content-Type: application/json' http://localhost:9200/jaso/_mapping/test -d '{
"properties": {
"name": {
"type": "text",
"store": true,
"analyzer": "suggest_index_analyzer",
"search_analyzer": "suggest_search_analyzer"
}
}
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/_analyze?pretty=true -d '{
"analyzer" : "suggest_index_analyzer",
"text" : "최일규 Hello"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/_analyze?pretty=true -d '{
"analyzer" : "suggest_search_analyzer",
"text" : "쵱"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/test?pretty=true -d '{
"name":"최일규 Hello"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/test?pretty=true -d '{
"name":"초아"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/test/_search?pretty=true -d '{
"query" : {
"match" : { "name" : "초" }
}
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/test/_search?pretty=true -d '{
"query" : {
"match" : { "name" : "ㅊㅇㄱ" }
}
}'