Overview
This article explains Elasticsearch index CRUD operations and IK analyzer config, covering versions 7.3.0 and 8.15.0.
Version Compatibility Matrix
| Component | Version | Notes |
|---|---|---|
| Elasticsearch | 7.3.0, 8.15.0 | Verified |
| IK Analyzer | 7.3.0 / 8.x | Must match ES version |
| Remote Dictionary | Nginx static hosting | UTF-8 no BOM |
Index Operations
Create Index
PUT /index-name
Example: PUT /wzkicu-index
Check if Index Exists
- Single index:
GET /index-name - Multiple indexes:
GET /index1,index2,index3 - All indexes:
GET _allorGET /_cat/indices?v
Open/Close Index
- Open index:
POST /index-name/_open - Close index:
POST /index-name/_close
Delete Index
DELETE /index-name
Health Status
- Green: All shards properly allocated
- Yellow: At least one replica unallocated
- Red: At least one primary shard unallocated
IK Analyzer Installation
Install Plugin
cd /opt/servers/elasticsearch-7.3.0/
bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/7.3.0
Test Tokenization
POST _analyze
{
"analyzer": "ik_max_word",
"text": "山东省青岛市黄岛区"
}
Two modes:
- ik_max_word: Finest granularity tokenization
- ik_smart: Coarsest granularity tokenization
Remote Dictionary Config
Configure Nginx
apt install nginx
Create Dictionary Files
/var/www/html/stop_dict.dic- Stop words (的, 了, 啊, 呢)/var/www/html/ext_dict.dic- Extended words
Configure IK Analyzer
Edit IKAnalyzer.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer Extension</comment>
<entry key="remote_ext_dict">http://your-domain/ext_dict.dic</entry>
<entry key="remote_ext_stopwords">http://your-domain/stop_dict.dic</entry>
</properties>
Notes
- Need to restart ES after config modification
- Use
_analyzeAPI to verify analyzer takes effect - Dictionary files must be UTF-8 no BOM format
- IK plugin version must exactly match ES version
Error Quick Reference
| Symptom | Root Cause | Solution |
|---|---|---|
| unknown analyzer [ik_max_word] | IK not installed or version mismatch | Check plugins/analysis-ik directory; reinstall matching version |
| Dictionary modification not taking effect | URL unreachable or encoding issue | Verify with curl; ensure UTF-8; restart ES |
| Multi-index query returns 404 | Some indexes don’t exist | Confirm with _cat/indices?v |
| Cluster health yellow | Single node replica not allocated | Set replica count to 0 or add more nodes |
| Cluster health red | Primary shard allocation failed | Check _cluster/allocation/explain |
Key Point: IK analyzer version must match Elasticsearch version, must restart ES after config modification.