Overview

This article explains Elasticsearch index CRUD operations and IK analyzer config, covering versions 7.3.0 and 8.15.0.

Version Compatibility Matrix

ComponentVersionNotes
Elasticsearch7.3.0, 8.15.0Verified
IK Analyzer7.3.0 / 8.xMust match ES version
Remote DictionaryNginx static hostingUTF-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 _all or GET /_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

  1. Need to restart ES after config modification
  2. Use _analyze API to verify analyzer takes effect
  3. Dictionary files must be UTF-8 no BOM format
  4. IK plugin version must exactly match ES version

Error Quick Reference

SymptomRoot CauseSolution
unknown analyzer [ik_max_word]IK not installed or version mismatchCheck plugins/analysis-ik directory; reinstall matching version
Dictionary modification not taking effectURL unreachable or encoding issueVerify with curl; ensure UTF-8; restart ES
Multi-index query returns 404Some indexes don’t existConfirm with _cat/indices?v
Cluster health yellowSingle node replica not allocatedSet replica count to 0 or add more nodes
Cluster health redPrimary shard allocation failedCheck _cluster/allocation/explain

Key Point: IK analyzer version must match Elasticsearch version, must restart ES after config modification.