安裝 IKAnalyzer
如果是使用官方ELK Docker yml 安裝的話,會有三個 cluster,這裡示範在es01安裝中文分詞
進入 elasticsearch bash
docker exec -it ex01 bash
在 Elasticsearch bash 中,下載並安裝 IKAnalyzer
IKAnalyzer 與Elasticsearch 有版本對應的問題,需要注意目前所安裝的Elastic版本是多少
IKAnalyzer
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.0/elasticsearch-analysis-ik-7.12.0.zip
進入IKAnalyzer.cfg.xml
vi config/analysis-ik/IKAnalyzer.cfg.xml
如果檔案是亂碼,在vi中輸入:set encoding=utf-8
編輯 IKAnalyzer.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">custom/custom.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<entry key="remote_ext_dict"></entry>
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
添加字典檔
cd config/analysis-ik
mkdir custom
wget https://raw.githubusercontent.com/samejack/sc-dictionary/master/main.txt -O custom/custom.dic
如果出現 > bash: wget: command not found
先執行 yum -y install wget
1.到 kibana 的 Dev Tools
2.輸入以下內容至工作區
GET /_analyze
{
"text": "鬼滅之刃",
"analyzer": "ik_smart"
}
3.若安裝成功,執行上面的指令後應該要回傳
{
"tokens" : [
{
"token" : "鬼",
"start_offset" : 0,
"end_offset" : 1,
"type" : "CN_CHAR",
"position" : 0
},
{
"token" : "滅",
"start_offset" : 1,
"end_offset" : 2,
"type" : "CN_CHAR",
"position" : 1
},
{
"token" : "之刃",
"start_offset" : 2,
"end_offset" : 4,
"type" : "CN_WORD",
"position" : 2
}
]
}
Elastic App Search 後端連接有兩種方式,一種是透過ELK的Elastic 去取得 Elastic App 的資料,第二種是直接用Java 打API的方式,去取得 Elastic App Search 的資料 一、透過ELK查詢 Elastic App Search 取得Elastic App Search 的 index,可以從Kibana取得所有的Elastic 列表,GET _cat/indices?v&index=*engine* 回傳的結果
Apr 8, 2021Elastic App Search 透過前端連接來執行搜尋的動作,本文僅示範JavaScript連接 一、支援的客戶端 JavaScript Node.js PHP Python Ruby
Apr 8, 2021Elastic cloud 透過 Spring 實做遠端連接功能 一、依賴項 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId>
Apr 8, 2021Elasticsearch docker 透過 Spring 實做本地連接功能 一、依賴項 <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>7.12.0</version> </dependency> 二、寫入資料
Apr 8, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up