<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          終于有 Go 版的 Elasticsearch 了

          共 4244字,需瀏覽 9分鐘

           ·

          2021-12-17 03:59

          閱讀本文大概需要 3?分鐘。

          大家好,我是 polarisxu。

          企業(yè)內(nèi)部搭建搜索引擎常用 Solr、Elasticsearch,它們都是使用 Java 實(shí)現(xiàn)的,底層依賴(lài) Lucene,Java 相對(duì)來(lái)說(shuō)占用較多內(nèi)存。而今天要介紹的這個(gè)項(xiàng)目,目標(biāo)就是作為 ES 的替代者,一個(gè)輕量級(jí)搜索引擎:Zinc。

          項(xiàng)目地址:https://github.com/prabhatsharma/zinc,該項(xiàng)目開(kāi)源十來(lái)天,目前 Star 數(shù) 3.4k+。


          Zinc 是一個(gè)全文索引的搜索引擎。它是 Elasticsearch 的輕量級(jí)替代品,可以在不到 100 MB 的 RAM 中運(yùn)行。它使用 bluge 作為底層索引庫(kù)。

          而且,Zinc 使用 Vue 打造了一個(gè)比 Elasticsearch 更簡(jiǎn)單、更易于操作的界面。

          zinc

          如果你只是使用 API 獲取數(shù)據(jù)并使用 kibana 進(jìn)行搜索(Kibana 不支持 Zinc。Zinc 提供了自己的 UI),那么它是 Elasticsearch 的直接替代品。

          Zinc 主要有如下特性:

          1. 提供全文索引功能
          2. 單個(gè)二進(jìn)制文件即可安裝、運(yùn)行,支持多平臺(tái)。這得益于 Go 語(yǔ)言
          3. 用 Vue 編寫(xiě)的用于查詢(xún)數(shù)據(jù)的 Web UI
          4. 與 Elasticsearch 兼容的數(shù)據(jù)獲取 API(單記錄和批量 API)
          5. 開(kāi)箱即用的身份驗(yàn)證
          6. Schema less - 無(wú)需預(yù)先定義 schema,同一索引中的不同文檔可以有不同的字段

          不過(guò),目前 Zinc 還處于 alpha 階段,而且缺少集群,可用性也沒(méi)得到很好的驗(yàn)證。

          關(guān)于如何安裝使用,項(xiàng)目首頁(yè)有說(shuō)明,支持普通安裝(可以直接下載編譯好的二進(jìn)制文件),也支持 Docker 和 K8S 安裝使用。

          我根據(jù)說(shuō)明,在本地搭建后,根據(jù)提供的示例數(shù)據(jù)構(gòu)建索引:

          $?FIRST_ADMIN_USER=admin?FIRST_ADMIN_PASSWORD=Complexpass#123?./zinc
          {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Loading?indexes..."}
          {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Loading?system?indexes..."}
          {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Index?loaded:?_users"}
          {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Index?loaded:?_index_mapping"}
          {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Error?loading?.env?file"}
          [GIN-debug]?[WARNING]?Running?in?"debug"?mode.?Switch?to?"release"?mode?in?production.
          ?-?using?env:?export?GIN_MODE=release
          ?-?using?code:?gin.SetMode(gin.ReleaseMode)

          [GIN-debug]?GET????/healthz??????????????????-->?github.com/prabhatsharma/zinc/pkg/meta/v1.GetHealthz?(3?handlers)
          [GIN-debug]?GET????/?????????????????????????-->?github.com/prabhatsharma/zinc/pkg/meta/v1.GUI?(3?handlers)
          [GIN-debug]?GET????/ui/*filepath?????????????-->?github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1?(3?handlers)
          [GIN-debug]?HEAD???/ui/*filepath?????????????-->?github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1?(3?handlers)
          [GIN-debug]?POST???/api/login????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.ValidateCredentials?(3?handlers)
          [GIN-debug]?PUT????/api/user?????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.CreateUpdateUser?(4?handlers)
          [GIN-debug]?DELETE?/api/user/:userID?????????-->?github.com/prabhatsharma/zinc/pkg/handlers.DeleteUser?(4?handlers)
          [GIN-debug]?GET????/api/users????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.GetUsers?(4?handlers)
          [GIN-debug]?PUT????/api/index????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.CreateIndex?(4?handlers)
          [GIN-debug]?GET????/api/index????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.ListIndexes?(4?handlers)
          [GIN-debug]?PUT????/api/:target/document?????-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?POST???/api/:target/_search??????-->?github.com/prabhatsharma/zinc/pkg/handlers.SearchIndex?(4?handlers)
          [GIN-debug]?PUT????/es/:target/_doc/:id??????-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?DELETE?/es/:target/_doc/:id??????-->?github.com/prabhatsharma/zinc/pkg/handlers.DeleteDocument?(4?handlers)
          [GIN-debug]?POST???/es/:target/_doc??????????-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?PUT????/es/:target/_create/:id???-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?POST???/es/:target/_create/:id???-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?POST???/es/:target/_update/:id???-->?github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument?(4?handlers)
          [GIN-debug]?POST???/es/_bulk?????????????????-->?github.com/prabhatsharma/zinc/pkg/handlers.BulkHandler?(4?handlers)
          [GIN-debug]?POST???/es/:target/_bulk?????????-->?github.com/prabhatsharma/zinc/pkg/handlers.BulkHandler?(4?handlers)
          [GIN-debug]?Listening?and?serving?HTTP?on?:4080

          訪問(wèn) https://localhost:4080 即可看到上面的界面。

          目前 Go 語(yǔ)言中文網(wǎng)的搜索使用的是 Solr,抽空嘗試驗(yàn)證 Zinc,如果穩(wěn)定、成熟,考慮遷移到 Zinc。




          往期推薦


          我是 polarisxu,北大碩士畢業(yè),曾在 360 等知名互聯(lián)網(wǎng)公司工作,10多年技術(shù)研發(fā)與架構(gòu)經(jīng)驗(yàn)!2012 年接觸 Go 語(yǔ)言并創(chuàng)建了 Go 語(yǔ)言中文網(wǎng)!著有《Go語(yǔ)言編程之旅》、開(kāi)源圖書(shū)《Go語(yǔ)言標(biāo)準(zhǔn)庫(kù)》等。


          堅(jiān)持輸出技術(shù)(包括 Go、Rust 等技術(shù))、職場(chǎng)心得和創(chuàng)業(yè)感悟!歡迎關(guān)注「polarisxu」一起成長(zhǎng)!也歡迎加我微信好友交流:gopherstudio


          瀏覽 110
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国内精品在线观看小视频 | 在线看黄色电影 | 色鬼色综合 | 日韩骚货 | 俺去一在线三区 |