---
title: "安装elasticsearch-head踩的坑"
author: "mwhgJava"
date: "2021-03-09T09:07:21Z"
tags: []
categories: ["Web前端"]
slug: "elasticsearch-head"
draft: false
lastmod: "2021-03-09T09:06:35Z"
id: 2519580
url: "https://mwhgjava.iteye.com/blog/2519580"
---

**elasticsearch-head **
ealsticsearch只是后端提供各种api，那么怎么直观的使用它呢？elasticsearch-head将是一款专门针对于elasticsearch的客户端工具。
elasticsearch-head配置包，下载地址：https://github.com/mobz/elasticsearch-head。

1.npm install, npm start的npm是什么？
   npm是Nodejs下的包管理器，安装Nodejs就可以附带安装npm了。
   https://nodejs.org/zh-cn/ 下载长期支持版本：LTS
   
2.elasticsearch-head安装目录：
  elasticsearch-head的1.x,2.x版本，作为elasticsearch插件，部署在elastic-search/plugins目录下。
  elasticsearch-head的5.x以上版本，是作为独立服务存在的。需要部署在elasticsearch安装目录之外。否则启动elasticsearch是会报elasticsearch-head version错误。

3.elasticsearch-head和elasticsearc都正常启动，但是elasticsearch-head却无法访问elasticsearch，原因：cors问题。
  需要：在修改elasticsearch/config/elasticsearch.yml添加跨域配置：

```yml

http.cors.enabled: true
http.cors.allow-origin: "*"

```