1>下载:https://www.elastic.co/downloads/elasticsearch 5.2.2
2>解压后直接启动 我是在windows上搞的,直接打开 elasticsearch.bat
PS:安装java jdk1.8, 1.7没试,应该跑不起来.
3:浏览器访问http://localhost:9200/看到以下信息就说明启动成功了
{
"name" : "HwBUKHJ",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "dYC7YLWBRDGmjidzlOIUwA",
"version" : {
"number" : "5.2.2",
"build_hash" : "f9d9b74",
"build_date" : "2017-02-24T17:26:45.835Z",
"build_snapshot" : false,
"lucene_version" : "6.4.1"
},
"tagline" : "You Know, for Search"
}
4>安装elasticsearch-head插件
这里需要注意下,之前的安装方式是 plugin -install xxx 5.2.2变成elasticsearch-plugin install XX
这个方法不能安装elasticsearch-head,需要作为一个单独的服务器启动
git clone git://github.com/mobz/elasticsearch-head.git //下载
cd elasticsearch-head
npm install
npm install -g grunt-cli(安装过请忽略)
/*
在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行
cd elasticsearch-head
npm install grunt --save
*/
grunt server
open http://localhost:9100/
浏览器可以看到head提供的页面,但是连接不上elasticsearch.需要在elasticsearch5.2.2的配置里增加一下参数
http.cors.enabled: true
http.cors.allow-origin: "*"
重启elasticsearch后,刷新elasticsearch-head的页面(http://localhost:9100/),发现链接正常了.
接下来分享下java操作elasticsearch