zoukankan      html  css  js  c++  java
  • Elasticsearch集成IKAnalyzer分析器

    1. 查看标准分析器的分词结果
                http://127.0.0.1:9200/_analyze?analyzer=standard&text=标准分析器

        都分成了单个汉字,不好用

    2.第三方IKAnalyzer分析器
                2.1 ES集成IK分析器
                    步骤一:将IK分析器压缩包解压
                    步骤二:将解压后的文件夹复制到ES解压目录的plugins
                    步骤三: 重启ES
                    注意:文件路径不要带空格
                2.2 使用IK分析器进行分析
                    ik_smart 最小分析
                        http://127.0.0.1:9200/_analyze?analyzer=ik_smart&text=第三方IKAnalyzer分析器


                    ik_max_word 最细分析
                        http://127.0.0.1:9200/_analyze?analyzer=ik_max_word&text=第三方IKAnalyzer分析器
                


                2.3 用ik分析器替换标准分析器,创建Type时,指定ik

                    {
                        "mappings":{
                            "hello":{
                                "properties":{
                                    "id":{
                                        "type":"long",
                                        "store":true,
                                        "index":"not_analyzed"
                                    },
                                    "title":{
                                        "type":"text",
                                        "store":true,
                                        "index":"analyzed",
                                        "analyzer":"ik_max_word"
                                    },
                                    "cpontent":{
                                        "type":"text",
                                        "store":true,
                                        "index":"analyzed",
                                        "analyzer":"ik_max_word"
                                    }
                                }    
                            }
                        }
                    }

     存俩条信息,搜索服务器索引

  • 相关阅读:
    排序算法的稳定性
    字符串处理常用函数
    判断两棵二叉树是否相等
    约瑟夫环
    自加++
    Linux 安装配置 Tomcat
    在 eclipse 中将 web 项目部署到 tomcat 服务器上
    PHP连接MySQL数据库
    logback
    Log4J
  • 原文地址:https://www.cnblogs.com/chx9832/p/12372661.html
Copyright © 2011-2022 走看看