(자동완성 플러그인)
$ sh gradlew clean build buildPluginZip
#플러그인이 자동으로 설치된다.
cd docker
docker-compose up -d
bin/elasticsearch-plugin install https://github.com/netcrazy/elasticsearch-jaso-analyzer/releases/download/v8.6.2/jaso-analyzer-plugin-8.6.2-plugin.zip
bin/elasticsearch-plugin remove jaso-analyzer
curl -XDELETE 'http://localhost:9200/jaso'
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"
]
}
}
}
}
}
}'
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 -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/_doc?pretty=true -d '{
"name":"최일규 Hello"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/_doc?pretty=true -d '{
"name":"초아"
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/_search?pretty=true -d '{
"query" : {
"match" : { "name" : "초" }
}
}'
curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/jaso/_search?pretty=true -d '{
"query" : {
"match" : { "name" : "ㅊㅇㄱ" }
}
}'