zoukankan      html  css  js  c++  java
  • ElasticSearch 6.0.0 & IK分词 & Kibana 6.0.0

    1. 安装ES 6.0.0

    docker run -itd -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name=elasticsearch docker.elastic.co/elasticsearch/elasticsearch:6.0.0
    

    2. 安装Kibana 6.0.0

    docker run -dit -p 5601:5601 --name=kibana --link elasticsearch:elasticsearch docker.elastic.co/kibana/kibana:6.0.0
    

    3. 安装 ik 插件

    elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.0.0/elasticsearch-analysis-ik-6.0.0.zip
    

    4. 重启ES

    5. 创建索引

    curl -XPUT http://localhost:9200/index
    

    6.设置映射

    curl -XPOST http://localhost:9200/index/fulltext/_mapping -d'
    {
        "properties": {
            "content": {
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_max_word",
                "term_vector": "with_positions_offsets",
                "fielddata" : true
            }
        }
    }'
    

    7.插入数据

    curl -XPOST http://localhost:9200/index/fulltext/1 -d'
    {
        "content":"美国留给伊拉克的是个烂摊子吗"
    }'
    

    8.查询

    GET /index/fulltext/_search
    {
        "size" : 0,
        "query": {
          "term": {
            "_id": {
              "value": "2"
            }
          }
        }, 
        "aggs" : { 
            "cipin" : { 
                "terms" : { 
                  "size": 100, 
                  "field" : "content",
                  "include" : "本职工作|财务管理"
                }
            }
        }
    }
    
  • 相关阅读:
    python3.6配置flask
    jquery匿名函数和闭包(它山之石)笔记
    .net扩展方法
    对象继承
    MAC OS X PKG FILES
    NLP——天池新闻文本分类 Task2
    Python基础TASK1:变量与数据类型
    NLP——天池新闻文本分类 Task1
    随机分析与随机过程中的一些基本概念
    Java线程池
  • 原文地址:https://www.cnblogs.com/my3306/p/9760229.html
Copyright © 2011-2022 走看看