一、elasticsearch-head插件的作用

ealsticsearch是一个分布式、RESTful 风格的搜索和数据分析引擎,所有的数据都是后台服务存储着,类似于Mysql服务器,因此如果我们需要直观的查看数据,就需要使用可视化工具了。elasticsearch-head是Web前端,用于浏览和与Elastic Search集群进行交互,可用于集群管理、数据可视化、增删改查工具Elasticsearch语句可视化等。

二、elasticsearch-head插件的安装

  • 下载elasticsearch-head插件,地址:https://github.com/mobz/elasticsearch-head

  • 进入elasticsearch-head源码目录中,执行 npm install

    在运行npm install时,可能会存在Head插件phantomjs权限问题

    npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    npm WARN deprecated har-validator@5.1.5: this
    npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

    > phantomjs-prebuilt@2.1.16 install E:\JavaDevelopment\elasticsearch\elasticsearch-head-master\node_modules\phantomjs-prebuilt
    > node install.js

    PhantomJS not found on PATH
    Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
    Saving to C:\Users\ysxx\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
    Receiving...

    Error making request.
    Error: connect ETIMEDOUT 140.82.114.4:443
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)

    Please report this full log at https://github.com/Medium/phantomjs
    npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\ysxx\AppData\Roaming\npm-cache\_logs\2020-12-28T01_28_03_195Z-debug.log

    解决方案:在npm install命令后加 -g 参数

    npm install -g
  • 在install成功之后,执行 npm run start 启动head插件

    > elasticsearch-head@0.0.0 start E:\JavaDevelopment\elasticsearch\elasticsearch-head-master
    > grunt server

    >> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?

    Running "connect:server" (connect) task
    Waiting forever...
    Started connect web server on http://localhost:9100

    在cmd命令行可以看到 web server 地址,在浏览器访问该地址 http://localhost:9100如果出现elasticsearch-head插件连不上elasticsearch服务,需要在elasticsearch安装目录下的config文件夹,找到elasticsearch.yml文件,添加两行配置

    #表示是否支持跨域,默认为false
    http.cors.enabled: true
    #当设置允许跨域,默认为*,表示支持所有域名
    http.cors.allow-origin: "*"

三、elasticsearch-head插件的使用

  1. 界面概览

    集群健康值的颜色说明:

    颜色 说明
    绿色 最健康的状态,代表所有的分片包括备份都可用
    黄色 基本的分片可用,但是备份不可用(也可能是没有备份)
    红色 部分的分片可用,表明分片有一部分损坏。执行查询部分数据仍然可以查到,遇到这种情况,还是赶快解决比较好
    灰色 未连接到elasticsearch服务
  2. 数据概览

  3. 基本查询

    选择一个索引,然后再选择不同的查询条件,勾选“显示查询语句”,点击搜索,可以看到具体的查询json和查询结果,点击“显示原始JSON”,可以看到未经格式化的查询json

  4. 复合查询

    可以使用json进行复杂的查询,也可发送put请求新增及跟新索引,使用delete请求删除索引等等。

使用json进行复杂的查询,也可发送put请求新增及跟新索引,使用delete请求删除索引等等。

四、总结

elasticsearch-head插件是较早支持Elasticsearch的可视化客户端工具之一,目前功能还是能够使用,界面美感有些不足,在elasticsearch-head插件的GitHub上发布版本的时间(2018年4月)来看,应该属于功能基本停更的状态,这也是其使用上的不足之处吧。

elasticsearch-head插件可以对数据进行增删改查操作,故生产环境尽量不要使用,如果要使用,最少要限制IP地址。

Elasticsearch精进之路:elasticsearch-head插件使用教程的更多相关文章

  1. ElasticSearch(九):elasticsearch-head插件安装

    安装node 安装elasticsearch-head需要node.js的支持. 下载最新的node.js,下载地址:https://nodejs.org/en/download/ 将下载后的安装包放 ...

  2. Elasticsearch 6.3.1、Head插件 安装及配置

    安装Elasticsearch Elasticsearch下载地址:https://www.elastic.co/cn/downloads/elasticsearch 也可以直接使用wget下载到某目 ...

  3. 原创 | 手摸手带您学会 Elasticsearch 单机、集群、插件安装(图文教程)

    欢迎关注笔者的公众号: 小哈学Java, 每日推送 Java 领域干货文章,关注即免费无套路附送 100G 海量学习.面试资源哟!! 个人网站: https://www.exception.site/ ...

  4. elasticsearch集群部署以及head插件安装

    环境准备 elasticsearch是Java程序写的因此必须装jdk,否则使用不了. [root@openstack ~]# java -versionopenjdk version "1 ...

  5. 批量搞机(二):分布式ELK平台、Elasticsearch介绍、Elasticsearch集群安装、ES 插件的安装与使用

    一.分布式ELK平台 ELK的介绍: ELK 是什么? Sina.饿了么.携程.华为.美团.freewheel.畅捷通 .新浪微博.大讲台.魅族.IBM...... 这些公司都在使用 ELK!ELK! ...

  6. ElasticSearch实战系列一: ElasticSearch集群+Kinaba安装教程

    前言 本文主要介绍的是ElasticSearch集群和kinaba的安装教程. ElasticSearch介绍 ElasticSearch是一个基于Lucene的搜索服务器,其实就是对Lucene进行 ...

  7. python精进之路1---基础数据类型

    python精进之路1---基本数据类型 python的基本数据类型如上图,重点需要掌握字符串.列表和字典. 一.int.float类型 int主要是用于整数类型计算,float主要用于小数. int ...

  8. ElasticSearch 2 (9) - 在ElasticSearch之下(图解搜索的故事)

    ElasticSearch 2 (9) - 在ElasticSearch之下(图解搜索的故事) 摘要 先自上而下,后自底向上的介绍ElasticSearch的底层工作原理,试图回答以下问题: 为什么我 ...

  9. 【SpringBoot整合Elasticsearch】SpringBoot整合ElasticSearch

    一.Linux下安装ElasticSearch 1.检测是否安装了Elasticsearch ps aux |grep elasticsearch 2.安装JDK 3.下载Elasticsearch ...

随机推荐

  1. A. Vitaly and Strings

    Vitaly is a diligent student who never missed a lesson in his five years of studying in the universi ...

  2. Codeforces Round #547 (Div. 3) F1/2. Same Sum Blocks (Easy/Hard) (贪心,模拟)

    题意:有一长度为\(n\)的数组,求最多的区间和相同的不相交的区间的个数. 题解:我们可以先求一个前缀和,然后第一层循环遍历区间的右端点,第二层循环枚举左端点,用前缀和来\(O(1)\)求出区间和,\ ...

  3. Codeforces #637 div2 B. Nastya and Door

    题意:给你一个数组a,定义:若a[i]>a[i]&&a[i]>a[i-1],则a[i]为峰值,求长度为k的区间内峰值最多能为多少,并输出这个区间的左端点(区间需要将峰的左边 ...

  4. [Golang]-4 错误处理、Panic、Defer

    目录 错误和异常 案例 Panic Defer 使用 defer+recover 来处理错误 参考文章: Go 语言使用一个独立的·明确的返回值来传递错误信息的.这与使用异常的 Java 和 Ruby ...

  5. HDU 4336 Card Collector(状压 + 概率DP 期望)题解

    题意:每包干脆面可能开出卡或者什么都没有,一共n种卡,每种卡每包爆率pi,问收齐n种卡的期望 思路:期望求解公式为:$E(x) = \sum_{i=1}^{k}pi * xi + (1 - \sum_ ...

  6. 硬盘测试工具fio用法总结

    一  fio介绍 linux下的一种常用的磁盘测试工具,支持裸盘和文件形式进行测试   二  硬盘测试常用名词 延迟:io的发起到返回写入成功的时间成为延迟,fio中延迟分为lat,slat,clat ...

  7. php 安装 yii framework notice-error 的解决方案!

    1 问题描述: 2 解决方案: error_reporting(0); //解决error_notice 的最简单最有效的方法在每一个php文件的头部都加上error_reporting(0); 3. ...

  8. pagehide event & sendBeacon

    pagehide event & sendBeacon 通过 API 测试 pagehide 是否触发了 pagehide 不支持正常的 fetch 请求发送 pagehide 仅支持 sen ...

  9. 1 line of CSS Layouts

    1 line of CSS Layouts 10 modern layouts in 1 line of CSS 1. 绝对居中布局 <div class="container&quo ...

  10. Upcoming Browser Behavior Changes & Chrome & SameSite

    Upcoming Browser Behavior Changes & Chrome & SameSite Chrome 80 https://auth0.com/blog/brows ...