文章目录
环境要求
Jdk1.8
elasticsearch-6.8.6
elasticsearch-head-master
elasticsearch-6.8.6配置
1 下载
1 华为云提供好用的国内镜像Elasticsearch,选择elasticsearch-6.8.6下载
https://mirrors.huaweicloud.com/elasticsearch/
2 安装
解压到文件目录,例如 D:/
3 文件配置
在\elasticsearch-6.8.6\config\elasticsearch.yml文件最下面添加
表示可以任意连接
http.cors.enabled: true
http.cors.allow-origin: "*"
启动
双击点击 elasticsearch-6.8.6\bin\elasticsearch.bat
访问地址
http://localhost:9200/
elasticsearch-head-master (es操作)
1 下载
如下地址 master分支下载
https://github.com/mobz/elasticsearch-head
2 安装 运行
前置条件 安装 nodejs npm
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
http://localhost:9100/
基本操作
添加
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
查询
{
"_index" : "megacorp",
"_type" : "employee",
"_id" : "1",
"_version" : 1,
"found" : true,
"_source" : {
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
}
参考
Elasticsearch: 权威指南 :
https://www.elastic.co/guide/cn/elasticsearch/guide/current/_retrieving_a_document.html