ES鎻掍欢瀹夎

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ES鎻掍欢瀹夎相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/sea' title='sea'>sea   app   col   head   setting   濂界殑   class   search   

http://blog.csdn.net/napoay/article/details/53896348

#鏇存柊
sudo yum update -y


sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm


sudo yum install npm

sudo yum install -y git

sudo yum install -y bzip2

git clone git://github.com/mobz/elasticsearch-head.git

#灏嗘簮鐮佸寘涓嬭浇鍚庡壀鍒囧埌/bigdata鐩綍锛屽苟鏀规墍灞炵敤鎴峰拰缁?
sudo chown -R xiaoniu:xiaoniu /bigdata/elasticsearch-head

#杩涘叆鍒癳lasticsearch-head涓?
cd elasticsearch-head
#缂栬瘧瀹夎
npm install


鎵撳紑elasticsearch-head-master/Gruntfile.js锛屾壘鍒颁笅闈onnect灞炴€э紝鏂板hostname: 鈥?.0.0.0鈥?span style="color: #000000;">,
        connect: 
                        server: 
                                options: 
                                        hostname: 鈥?.0.0.0鈥?span style="color: #000000;">,
                                        port: 9100,
                                        base: 鈥?鈥?span style="color: #000000;">,
                                        keepalive: true
                                
                        
                



缂栬緫elasticsearch-5.4.3/config/elasticsearch.yml,鍔犲叆浠ヤ笅鍐呭锛?
http.cors.enabled: true
http.cors.allow-origin: "*"

#杩愯鏈嶅姟
npm run start

---------------------------------------------------------------------------------------------


瀹夎IK鍒嗚瘝鍣?
涓嬭浇瀵瑰簲鐗堟湰鐨勬彃浠?
https://github.com/medcl/elasticsearch-analysis-ik/releases


棣栧厛涓嬭浇es瀵瑰簲鐗堟湰鐨刬k鍒嗚瘝鍣ㄧ殑zip鍖咃紝涓婁紶鍒癳s鏈嶅姟鍣ㄤ笂锛屽湪es鐨勫畨瑁呯洰褰曚笅鏈変竴涓猵lugins鐨勭洰褰曪紝鍦ㄨ繖涓洰褰曚笅鍒涘缓涓€涓彨ik鐨勭洰褰?
鐒跺悗灏嗚В鍘嬪ソ鐨勫唴瀹癸紝鎷疯礉鍒癷k鐩綍
灏唅k鐩綍鎷疯礉鍒板叾浠栫殑es鑺傜偣
閲嶆柊鍚姩鎵€鏈夌殑es


#鍒涘缓绱㈠紩鍚嶅瓧鍙玭ews
curl -XPUT http://192.168.100.211:9200/news

#鍒涘缓mapping锛堢浉褰撲簬鏁版嵁涓殑schema淇℃伅锛岃〃鍚嶅拰瀛楁鍚嶄互鍙婂瓧娈电殑绫诲瀷锛?
curl -XPOST http://192.168.100.211:9200/news/fulltext/_mapping -d鈥?/span>

        "properties": 
            "content": 
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_max_word"
            
        
    
鈥?


curl -XPOST http://192.168.100.211:9200/news/fulltext/1 -d鈥?/span>
"content":"缇庡浗鐣欑粰浼婃媺鍏嬬殑鏄釜鐑傛憡瀛愬悧"鈥?

curl -XPOST http://192.168.100.211:9200/news/fulltext/2 -d鈥?/span>
"content":"鍏畨閮細鍚勫湴鏍¤溅灏嗕韩鏈€楂樿矾鏉?鈥?

curl -XPOST http://192.168.100.211:9200/news/fulltext/3 -d鈥?/span>
"content":"涓煩娓旇鍐茬獊璋冩煡锛氶煩璀﹀钩鍧囨瘡澶╂墸1鑹樹腑鍥芥笖鑸?鈥?

curl -XPOST http://192.168.100.211:9200/news/fulltext/4 -d鈥?/span>
"content":"涓浗椹绘礇鏉夌煻棰嗕簨棣嗛伃浜氳鐢峰瓙鏋嚮 瀚岀姱宸茶嚜棣?鈥?

curl -XPOST http://192.168.100.211:9200/news/fulltext/_search  -d鈥?/span>

    "query" :  "match" :  "content" : "涓浗" ,
    "highlight" : 
        "pre_tags" : ["<font color=鈥榬ed鈥?gt;", "<tag2>"],
        "post_tags" : ["</font>", "</tag2>"],
        "fields" : 
            "content" : 
        
    
鈥?

-------------------------------------------------------------------


curl -XGET 鈥榟ttp://centos7-2:9200/_analyze?pretty&analyzer=ik_max_word鈥?-d 鈥樿仈鎯虫槸鍏ㄧ悆鏈€澶х殑绗旇鏈巶鍟嗏€?span style="color: #000000;">

curl -XGET 鈥榟ttp://centos7-2:9200/_analyze?pretty&analyzer=ik_smart鈥?-d 鈥樿仈鎯虫槸鍏ㄧ悆鏈€澶х殑绗旇鏈巶鍟嗏€?span style="color: #000000;">

curl -XPUT 鈥榟ttps://192.168.100.211:9200/iktest?pretty鈥?-d 鈥榹
    "settings" : 
        "analysis" : 
            "analyzer" : 
                "ik" : 
                    "tokenizer" : "ik_max_word"
                
            
        
    ,
    "mappings" : 
        "article" : 
            "dynamic" : true,
            "properties" : 
                "subject" : 
                    "type" : "string",
                    "analyzer" : "ik_max_word"
                
            
        
    
鈥?

curl -XPUT 鈥榟ttps://192.168.100.211:9200/iktest?pretty鈥?-d 鈥榹
    "settings" : 
        "analysis" : 
            "analyzer" : 
                "ik" : 
                    "tokenizer" : "ik_max_word"
                
            
        
    ,
    "mappings" : 
        "article" : 
            "dynamic" : true,
            "properties" : 
                "subject" : 
                    "type" : "string",
                    "analyzer" : "ik_max_word"
                
            
        
    
鈥?



curl -XGET 鈥榟ttp://192.168.10.16:9200/_analyze?pretty&analyzer=ik_max_word鈥?-d ‘涓崕浜烘皯鍏卞拰鍥?rsquo;

---------------------------------------------------------------------------------------------

es瀹夎SQL鎻掍欢
./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.3.0/elasticsearch-sql-5.4.3.0.zip

#鐒跺悗灏嗚В鍘嬪埌plugins鐩綍涓嬬殑鍐呭鎷疯礉鍒板叾浠杄s鐨勮妭鐐圭殑plugins鐩綍

涓嬭浇SQL鐨凷erver
wget https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip

鐢╪pm缂栬瘧瀹夎
unzip es-sql-site-standalone.zip
cd site-server/
npm install express --save

淇敼SQL鐨凷erver鐨勭鍙?
vi site_configuration.json
鍚姩鏈嶅姟
node node-server.js &

 

以上是关于ES鎻掍欢瀹夎的主要内容,如果未能解决你的问题,请参考以下文章

Apicloud鈥斺€擭VTabBarAnimation鎻掍欢

绠€璁?jQuery 鎻掍欢妯℃澘

logstash甯哥敤鎻掍欢瑙f瀽

jenkins 鏇存柊鎻掍欢浣跨敤浠g悊

fullPage鏁欑▼ -- 鏁村睆婊氬姩鏁堟灉鎻掍欢 fullpage璇﹁В

33 涓彁楂樺墠绔伐浣滄晥鐜囩殑 VSCode 瀹炵敤鎻掍欢