ElectricSearch 及其head插件windows安裝

1.安裝ElectricSearch

1,從官方下載中心 ElasticSearch Download 下載ElasticSearch安裝包,

2,將zip文件解壓到D盤,進入 D:\elasticsearch-6.3.5\bin 目錄,雙擊執行 elasticsearch.bat,該腳本文件執行 ElasticSearch 啓動程序

3,打開瀏覽器,輸入 http://localhost:9200 ,顯式以下畫面,說明ES安裝成功

    ​{

  "name": "oD6k3LK",

  "cluster_name": "elasticsearch",

  "cluster_uuid": "VINcOIJ8Q2aK5j5aIb9paQ",​

  "version": {

    "number": "6.5.4",

    "build_flavor": "default",

    "build_type": "zip",

    "build_hash": "d2ef93d",

    "build_date": "2018-12-17T21:17:40.758843Z",

    "build_snapshot": false,

    "lucene_version": "7.5.0",

    "minimum_wire_compatibility_version": "5.6.0",

    "minimum_index_compatibility_version": "5.0.0"

  },

  "tagline": "You Know, for Search"

}

 

 

  2.安裝Head插件  

 

爲了便於管理ES,可使用head插件,這是最初級的管理工具,在瀏覽器中顯示ES集羣,索引等信息,十分簡便好用。 

1, 首先要安裝Nodejs,下載地址:https://nodejs.org/en/

2, 解壓  elasticsearch-head-master 到 D:\elasticsearch-6.3.5\elasticsearch-head-master

3, 配置 elasticsearch-6.3.1\config\elasticsearch.yml

 

# 設成0.0.0.0讓任何人都可以訪問,線上服務不要這樣設置。
network.host: 0.0.0.0http.port: 9200

# 解決elasticsearch-head 集羣健康值: 未連接問題(跨域)
http.cors.enabled: true
http.cors.allow-origin: "*"

4, 在elasticsearch-head-master目錄下執行 npm install -g grunt-cli

grunt 是基於Node.js的項目構建工具,可以進行打包壓縮、測試、執行等等的工作,head插件就是通過grunt啓動。

5, 在elasticsearch-head-master目錄下執行npm install 安裝依賴

6, 修改elasticsearch-head-master配置。

修改服務器監聽地址:Gruntfile.js  

   connect: {
            server: {
                options: {          
                   port: 9100,
                    base: '.',
                    keepalive: true,         
                    hostname: '*'
                }
            }
        }

7, 啓動運行head服務, 執行 grunt server 命令。

8, 訪問head管理頁面,地址:http://localhost:9100/   

至此,已安裝完成。

3.配置EalsticSearch爲Windows服務

切換到ElasticSearch的bin目錄執行相應命令:

安裝     elasticsearch-service.bat install

刪除     elasticsearch-service.bat remove

啓動     elasticsearch-service.bat start

停止     elasticsearch-service.bat stop

 

下載鏈接:

https://pan.baidu.com/s/1yv9lg8WOvSxlb2BO0kAI0w 提取碼:l6vK

在Elasticsearch中,文檔歸屬於一種類型(type),而這些類型存在於索引(index)中,我們可以畫一些簡單的對比圖來類比傳統關係型數據庫:
Elasticsearch集羣可以包含多個索引(indices)(數據庫),每一個索引可以包含多個類型(types)(表),每一個類型包含多個文檔(documents)(行),然後每個文檔包含多個字段(Fields)(列)

Relational DB -> Databases -> Tables -> Rows -> Columns
Elasticsearch -> Indices   -> Types  -> Documents -> Fields

1.根據關鍵字查詢:

http://127.0.0.1:9200/blog/hello/_search

{
"query":{
"term":{
"title":"張"
}
}
}

2.根據字符串查詢

http://127.0.0.1:9200/blog/hello/_search

{
"query":{
	"query_string":{
		"default_field":"title",
		"query":"檔一"
	}
}
}

IK分詞器

https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v6.5.4

下載下來解壓到ES的plugins的目錄下,當ES啓動時會自動掃描加載配置。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章