<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                jdk安裝:https://blog.csdn.net/nxstack/article/details/54380837 ~~~ java -version rpm -qa|grep java rpm -e --nodeps tzdata-java-2012c-1.el6.noarch rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64 mkdir /usr/local/java vi /etc/profile export JAVA_HOME=/usr/java/jdk1.7.0_71 export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin ~~~ 1、下載解壓 https://www.elastic.co/downloads/elasticsearch elasticsearch-6.2.2 中文分詞: 訪問http://IP:9200/,如果公網IP訪問不了,則 修改配置文件 config/elasticsearch.yml network.host: 0.0.0.0 非root啟動: ~~~ groupadd esg useradd -g esg esu chown -R esu:esg elasticsearch-6.2.2 ~~~ ./bin/elasticsearch啟動 啟動腳本: ~~~ [root@centos6 ~]# cat /etc/init.d/elastic #!/bin/sh #chkconfig: 2345 80 05 #description: elasticsearch export JAVA_HOME=/usr/local/java/jdk1.8.0_161 export JAVA_BIN=/usr/local/java/jdk1.8.0_161/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME JAVA_BIN PATH CLASSPATH case "$1" in start) su esu<<! cd /usr/local/src/elasticsearch-6.2.2 ./bin/elasticsearch -d ! echo "elasticsearch startup" ;; stop) es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'` kill -9 $es_pid echo "elasticsearch stopped" ;; restart) es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'` kill -9 $es_pid echo "elasticsearch stopped" su esu<<! cd /usr/local/src/elasticsearch-6.2.2 ./bin/elasticsearch -d ! echo "elasticsearch startup" ;; *) echo "start|stop|restart" ;; esac exit $? [root@centos6 ~]# ~~~ 單用戶啟動 如果一切正常,Elastic 就會在默認的9200端口運行。這時,打開另一個命令行窗口,請求該端口,會得到說明信息。 ~~~ $ curl localhost:9200 { "name" : "atntrTf", "cluster_name" : "elasticsearch", "cluster_uuid" : "tf9250XhQ6ee4h7YI11anA", "version" : { "number" : "5.5.1", "build_hash" : "19c13d0", "build_date" : "2017-07-18T20:44:24.823Z", "build_snapshot" : false, "lucene_version" : "6.6.0" }, "tagline" : "You Know, for Search" } ~~~ 二、基本概念 2.1 Node 與 Cluster Elastic 本質上是一個分布式數據庫,允許多臺服務器協同工作,每臺服務器可以運行多個 Elastic 實例。 單個 Elastic 實例稱為一個節點(node)。一組節點構成一個集群(cluster)。 2.2 Index Elastic 會索引所有字段,經過處理后寫入一個反向索引(Inverted Index)。查找數據的時候,直接查找該索引。 所以,Elastic 數據管理的頂層單位就叫做 Index(索引)。它是單個數據庫的同義詞。每個 Index (即數據庫)的名字必須是小寫。 下面的命令可以查看當前節點的所有 Index。 $ curl -X GET 'http://localhost:9200/_cat/indices?v' 2.3 Document Index 里面單條的記錄稱為 Document(文檔)。許多條 Document 構成了一個 Index。 Document 使用 JSON 格式表示,下面是一個例子。 { "user": "張三", "title": "工程師", "desc": "數據庫管理" } 同一個 Index 里面的 Document,不要求有相同的結構(scheme),但是最好保持相同,這樣有利于提高搜索效率。 2.4 Type Document 可以分組,比如weather這個 Index 里面,可以按城市分組(北京和上海),也可以按氣候分組(晴天和雨天)。這種分組就叫做 Type,它是虛擬的邏輯分組,用來過濾 Document。 不同的 Type 應該有相似的結構(schema),舉例來說,id字段不能在這個組是字符串,在另一個組是數值。這是與關系型數據庫的表的一個區別。性質完全不同的數據(比如products和logs)應該存成兩個 Index,而不是一個 Index 里面的兩個 Type(雖然可以做到)。 下面的命令可以列出每個 Index 所包含的 Type。 $ curl 'localhost:9200/_mapping?pretty=true' 根據規劃,Elastic 6.x 版只允許每個 Index 包含一個 Type,7.x 版將會徹底移除 Type。 三、新建和刪除 Index 新建 Index,可以直接向 Elastic 服務器發出 PUT 請求。下面的例子是新建一個名叫weather的 Index。 $ curl -X PUT 'localhost:9200/weather' 服務器返回一個 JSON 對象,里面的acknowledged字段表示操作成功。 { "acknowledged":true, "shards_acknowledged":true } 然后,我們發出 DELETE 請求,刪除這個 Index。 $ curl -X DELETE 'localhost:9200/weather' 四、中文分詞設置 首先,安裝中文分詞插件。這里使用的是 ik,也可以考慮其他插件(比如 smartcn)。 $ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.5.1/elasticsearch-analysis-ik-5.5.1.zip 上面代碼安裝的是5.5.1版的插件,與 Elastic 5.5.1 配合使用。 接著,重新啟動 Elastic,就會自動加載這個新安裝的插件。 然后,新建一個 Index,指定需要分詞的字段。這一步根據數據結構而異,下面的命令只針對本文。基本上,凡是需要搜索的中文字段,都要單獨設置一下。 ~~~ curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts' -d ' { "mappings": { "person": { "properties": { "user": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" }, "title": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" }, "desc": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } } } } }' curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts/person/1' -d ' { "user": "張三", "title": "工程師", "desc": "數據庫管理" }' curl -H "Content-Type: application/json" -X POST 'localhost:9200/accounts/person' -d ' { "user": "李四", "title": "工程師", "desc": "系統管理" }' curl -H "Content-Type: application/json" -X PUT 'localhost:9200/accounts/person/1' -d ' { "user" : "張三", "title" : "工程師", "desc" : "數據庫管理,軟件開發" }' curl -H "Content-Type: application/json" 'localhost:9200/accounts/person/_search' -d ' { "query" : { "match" : { "desc" : "軟件" }} }' curl -H "Content-Type: application/json" 'localhost:9200/accounts/person/_search' -d ' { "query" : { "match" : { "desc" : "管理" }}, "from": 1, "size": 1 }' curl -H "Content-Type: application/json" 'localhost:9200/accounts/person/_search' -d ' { "query" : { "match" : { "desc" : "軟件 系統" }} }' curl -H "Content-Type: application/json" 'localhost:9200/accounts/person/_search' -d ' { "query": { "bool": { "must": [ { "match": { "desc": "開發" } }, { "match": { "desc": "庫" } } ] } } }' ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看