美文网首页
ElasticSearch 笔记

ElasticSearch 笔记

作者: 三分归元币 | 来源:发表于2020-10-30 16:31 被阅读0次

简单搭建

使用docker pull 一个elastic search 本地启动kibana 配置服务地址


image.png
image.png

基本命令

安装分词器

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip

kibana创建一个索引

PUT /city
{
    "settings":{
        "index":{
            "number_of_shards":3,
            "number_of_replicas":0
        }
    },
   "city_name":{
    "article":{
      "properties":{
        "id":{
          "type":"long"
        },
        "name":{
          "type":"text",
          "analyzer": "ik_max_word"
        }
      }
    }
  }
}

为索引添加一条数据

POST /city/city_name/_search
{
  "id":1,
  "name":"杭州"
}

查询索引数据

POST /city/_search
{
  "query": { "match": { "name": "苏州" } }
}

获取索引结构

GET city/_mappings

相关文章

网友评论

      本文标题:ElasticSearch 笔记

      本文链接:https://www.haomeiwen.com/subject/lfwkvktx.html