您的位置:首页 > 其它

ElasticSearch安装

2015-08-13 00:00 176 查看

ElasticSearch的安装

http://www.elasticsearch.org/下载最新的ElastiSearch版本。

解压下载文件。

cd到${esroot}/bin/,执行elasticsearch启动。

使用curl -XPOST localhost:9200/_shutdown关闭ES。

插件安装(head、bigdesk、ik-analyzer)

安装 elasticsearch-kopf 插件
bin/plugin -install lmenezes/elasticsearch-kopf
或者
https://github.com/lmenezes/elasticsearch-kopf 下载
浏览器查看

http://localhost:9200/_plugin/kopf/

head,一款H5的数据查看客户端:

elasticsearch-head是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序,你可以通过插件把它集成到es

插件安装方法1:

1.elasticsearch/bin/plugin -install mobz/elasticsearch-head

2.运行es

3.打开http://localhost:9200/_plugin/head/

插件安装方法2:

1.https://github.com/mobz/elasticsearch-head下载zip 解压

2.建立elasticsearch-1.0.0\plugins\head\文件

3.将解压后的elasticsearch-head-master文件夹下的文件copy到head

4.运行es

5.打开http://localhost:9200/_plugin/head/

在地址栏输入es服务器的ip地址和端口点connect就可以连接到集群。下面是连接后的视图。这是主界面,在这里可以看到es集群的基本信息(如:节点情况,索引情况)。



界面的右边有些按钮,如:node stats, cluster nodes,这些是直接请求es的相关状态的api,返回结果为json,如下图:



在索引下面有info和action两个按钮。info是可以查看索引的状态和mapping的定义。action是对索引进行操作,如:添加别名、刷新、关闭索引,删除索引等。





browser浏览界面,这个界面可以同时查看多个索引的数据,也可以查询指定字段的数据。



Structured Query查询界面,这个界面可以对某个索引进行一些复杂查询,如下面这个例子是查询product索引,构造boolquery,title字段里查询“产品”关键词,price范围为10到100的记录。



Any Request任意请求界面,这个界面可以说是个rest的客户端,可以通过它来对es进行一些请求操作或测试api接口,下面这个例子是把product索引的副本数设置为1,更多的api可以到es官网查询。




bigdesk,状态查看客户端:

./plugin -install lukas-vlcek/bigdesk/<bigdesk_version>

ik-analyzer,中文分词器:

git clone https://github.com/medcl/elasticsearch-analysis-ik.git
mvn clean install(前提是配置了maven)。

将target中的elasticsearch-analysis-ik-xxx.jar复制到${esroot}/plugins/ik/。

复制elasticsearch-analysis-ik(git repository)中config目录下ik内容到{esroot}/config。

配置${esroot}/conf/elasticsearch.yml,在最下方加入:

################################## Analyzer ###############################
index:
analysis:
analyzer:
ik:
alias: [ik_analyzer]
type: org.elasticsearch.index.analysis.IkAnalyzerProvider
ik_max_word:
type: ik
use_smart: false
ik_smart:
type: ik
use_smart: true


测试:

head:http://localhost:9200/_plugin/head/
bigdesk:http://localhost:9200/_plugin/bigdesk/
ik:curl ‘localhost/idx/_analyze?analyzer=ik_smart’ -d ‘中国人和中国’

参照文档:
http://www.oschina.net/translate/elasticsearch-getting-started?cmp
集成分词器的 ElasticSearch 下载地址 :
https://github.com/medcl/elasticsearch-rtf
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: