如何给Elasticsearch安装中文分词器IK

 

安装Elasticsearch安装中文分词器IK的步骤:

1. 停止elasticsearch 2.2的服务

2. 在以下地址下载对应的elasticsearch-analysis-ik插件安装包(版本要和elasticsearch版本对应)。

    https://github.com/medcl/elasticsearch-analysis-ik/releases

    我这里下载的是: https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.2.2/elasticsearch-analysis-ik-5.2.2.zip

3. 解压并重新命名根目录文件夹的名字,我这里叫ik

4. 把ik文件夹拷贝到 d:/elasticsearch 2.2/plugin下

5. 启动elasticsearch 2.2的服务。

 

 

以下是测试语句

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
GET testdb/_search
DELETE testdb
PUT testdb
PUT /testdb/ms/_mapping
{
  "ms": {
     "_all": {
 
            "analyzer": "ik_max_word",
 
            "search_analyzer": "ik_max_word",
 
            "term_vector": "no",
 
            "store": "false"
 
        },
    "properties": {
      "m": {
        "type": "text",
 
                "analyzer": "ik_max_word",
 
                "search_analyzer": "ik_max_word",
 
                "include_in_all": "true",
 
                "boost": 8
      }
    }
  }
}
POST /testdb/ms/
{
  "m":"韩薇薇是个不折不扣的女大学生"
}
 
 
GET /testdb/ms/_search
{
  "size": 0,
  "aggs": {
    "top": {
      "terms": {
        "field": "m",
        "size": 50
      }
    }
  }
}

 

好消息,

程序员专用早餐机。和掌柜说 ideaam,可以节省20元。 点击链接  或復·制这段描述¥k3MbbVKccMU¥后到淘♂寳♀

或者 淘宝扫码 支持下同行哈

----------------------------------------------------------------------------------------------------------------------------

posted @   iDEAAM  阅读(1562)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
点击右上角即可分享
微信分享提示