Install the Chinese analyzer plugin
docker exec -it elasticsearch bash
$ elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.4.1/elasticsearch-analysis-ik-8.4.1.zip
- Dev Tools
- The
content field is text. Use ik_max_word for indexing and ik_smart for searching. The former generates as many tokens as possible, while the latter generates coarser-grained tokens.
PUT /words
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_smart"
},
"age": {
"type": "integer",
"index": false
}
}
}
}
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "words"
}