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中的聚合運算和全文搜索。