Elasticsearch
修改分析器
步骤:
- 关闭索引
- 修改分析器
- 打开索引
- 重建索引
- 尝试
关闭索引
### 关闭索引
POST /docs-index/_close
content-type: text/plain
Authorization: {{token}}
修改分析器
### 指定默认索引
PUT /docs-index/_settings
content-type: application/json
Authorization: {{token}}
{
    "analysis": {
        "analyzer": {
            "default": {
            "type": "whitespace"
            },
            "default_search": {
            "type": "whitespace"
            }
        }
    }
}打开索引
### 打开索引
POST /docs-index/_open
content-type: text/plain
Authorization: {{token}}重建索引
### 重建索引
POST /docs-index/_update_by_query
content-type: text/plain
Authorization: {{token}}
### 重建索引,conflicts=proceed表示在重建索引的过程中出现某个文档报错, 不要终止, 继续重建索引.
POST /docs-index/_update_by_query?conflicts=proceed
content-type: text/plain
Authorization: {{token}}尝试
#### 重建索引后尝试搜索1-空格是没有问题的
GET /docs-index/_search
content-type: application/json
Authorization: {{token}}
{
    "query" : {
        "match" : {
            "title" : {
                "query": "绑定 今天"
            }
        }
    }
}
#### 重建索引后尝试搜索2-数组是按照了空格来
GET /docs-index/_search
content-type: application/json
Authorization: {{token}}
{
    "query" : {
        "match" : {
            "contentKeywords" : {
                "query": "绑定 今天"
            }
        }
    }
}
