zoukankan      html  css  js  c++  java
  • ES、kibana安装及交互操作

    一、ES的安装与启动

    1、ES安装(Windows环境)

    • 下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
    • 版本:6.3.2
    • 运行环境:jdk1.8以上
    • 双击.bat启动

    2、查看效果

    浏览器输入:http://localhost:9200,返回如下json。

    {
      "name" : "RDFnj43",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "X-h3NABsTPOitRIeqIJj4Q",
      "version" : {
        "number" : "6.3.2",
        "build_flavor" : "default",
        "build_type" : "zip",
        "build_hash" : "053779d",
        "build_date" : "2018-07-20T05:20:23.451332Z",
        "build_snapshot" : false,
        "lucene_version" : "7.3.1",
        "minimum_wire_compatibility_version" : "5.6.0",
        "minimum_index_compatibility_version" : "5.0.0"
      },
      "tagline" : "You Know, for Search"
    }

    证明启动成功

    二、kibana安装及启动

    1、kibana安装(Windows环境)

    • 下载地址:https://www.elastic.co/cn/downloads/past-releases#kibana
    • 版本:6.3.2
    • 运行环境:jdk1.8以上
    • 双击.bat启动

    2、查看效果

    浏览器输入:http://localhost:5601,如下所示,证明启动成功

    三、交互操作

    1、ES与mysql的对应关系理解

    2、使用postman与ES交互操作案例

    Get 查看所有索引
    
    localhost:9200/_all
    
    PUT 创建索引-test
    
    localhost:9200/test  
    
    
    DEL 删除索引-test
    
    localhost:9200/test  
    
    
    PUT 创建索引-person-1
    
    localhost:9200/person
    
    
    PUT 新增数据-person-1
    
    localhost:9200/person/_doc/1
    
    {
        "first_name" : "John",
      "last_name" : "Smith",
      "age" : 25,
      "about" : "I love to go rock climbing",
      "interests" : [ "sports", "music" ]
    }
    
    PUT 新增数据-person-2
    
    localhost:9200/person/_doc/2
    
    {
        "first_name" : "Eric",
      "last_name" : "Smith",
      "age" : 23,
      "about" : "I love basketball",
      "interests" : [ "sports", "reading" ]
    }
    
    GET 搜索数据-person-id
    
    localhost:9200/person/_doc/1
    
    GET 搜索数据-person-name
    
    localhost:9200/person/_doc/_search?q=first_name:john
    
    {
      "took": 56,
      "timed_out": false,
      "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": {
          "value": 1,
          "relation": "eq"
        },
        "max_score": 0.6931472,
        "hits": [
          {
            "_index": "person",
            "_type": "_doc",
            "_id": "1",
            "_score": 0.6931472,
            "_source": {
              "first_name": "John",
              "last_name": "Smith",
              "age": 25,
              "about": "I love to go rock climbing",
              "interests": [
                "sports",
                "music"
              ]
            }
          }
        ]
      }
    }
    • GET为查询操作
    • PUT为创建索引
    • DELETE为删除索引

    3、使用kibana与ES交互操作

    找到dev tools,进行交互操作

    //查询所有的索引
    GET _all1
    //按照id查询
    GET person/_doc/2

    与es交互式操作格式:

    POST /person/_search
    {
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "interests": "FOOTBALL"
              }
            },
            {
              "match": {
                "userName": "ESRC22"
              }
            }
          ]
        }
      }
    }
    • must为且的关系
    • must处为should的时候为或的关系
  • 相关阅读:
    Atitti 图像处理 图像混合 图像叠加 blend 原理与实现
    Atitit Gaussian Blur 高斯模糊 的原理and实现and 用途
    Atitit 图像处理 灰度图片 灰度化的原理与实现
    Atitit (Sketch Filter)素描滤镜的实现  图像处理  attilax总结
    Atitit 实现java的linq 以及与stream api的比较
    Atitit attilax在自然语言处理领域的成果
    Atitit 图像处理 常用8大滤镜效果 Jhlabs 图像处理类库 java常用图像处理类库
    Atitit 图像处理--图像分类 模式识别 肤色检测识别原理 与attilax的实践总结
    Atitit apache 和guava的反射工具
    atitit。企业的价值观 员工第一 vs 客户第一.docx
  • 原文地址:https://www.cnblogs.com/longronglang/p/12006939.html
Copyright © 2011-2022 走看看