ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。html
brew install elasticsearch@5.6
1.结果:node
2.开启、关闭、重启esmysql
brew services start elasticsearch@5.6 brew services stop elasticsearch@5.6 brew services restart elasticsearch@5.6
3.灌入数据方式(测试时我使用的是postman)git
1.目的:用于查看es的状态和信息(也能够查看数据)。github
2.github地址: elasticsearch-headweb
我安装的是chrome extension,安装方法以下:sql
Running as a Chrome extension Install ElasticSearch Head from the Chrome Web Store. Click the extension icon in the toolbar of your web browser.
3.结果:chrome
1.目的:使用通常的sql来对es进行查询和聚合express
2.github地址:elasticsearch-sqlnpm
3.根据相应的es版本使用手册上面相应的命令安装该插件。
好比个人安装命令是:
elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.6.8.0/elasticsearch-sql-5.6.8.0.zip
4.使用方式
http://localhost:9200/_sql?sql=select * from song001/list001
根据官网介绍
On elasticsearch 5.x/6.x, download and extract site. Then start the web front-end like this: cd site-server npm install express --save node node-server.js
因此下载zip包,解压到本身的目录下面,好比个人目录是这样:
而后按照手册所说运行。(请提早安装好node啦~~)
http-proxy-middleware
代理github地址:http-proxy-middleware
修改node-server.js代码以后运行node node-server.js
var express = require('express'); var proxy = require('http-proxy-middleware'); var app = express(); app.use(express.static('../_site')); app.use('/_sql', proxy({target: 'http://localhost:9200/', changeOrigin: true})); app.get('/', function (req, res) { res.sendFile("../_site/" + "index.html" ); }) var fs = require('fs'); var siteConfiguration = JSON.parse(fs.readFileSync('site_configuration.json', 'utf8')); var server = app.listen(siteConfiguration.port) // var express = require('express'); // var app = express(); // app.listen(3000);
https://www.elastic.co/guide/...
先占坑,后期会补充在es中的聚合运算和全文搜索。