Elasticsearch 的交互庫:Elastomer-Client
Elastomer-Client 為 ElasticSearch API endpoint 提供一個一對一的映射。API 通過你想要實現的來分解為邏輯部分和訪問,每一個邏輯部分代表一個客戶端類。
示例代碼:
require 'elastomer/client' client = Elastomer::Client.new index = client.index('推ter') index.create( :settings => { 'index.number_of_shards' => 3 }, :mappings => { :tweet => { :_source => { :enabled => true }, :_all => { :enabled => false }, :properties => { :author => { :type => 'string', :index => 'not_analyzed' }, :tweet => { :type => 'string', :analyze => 'standard' } } } } ) index.exists? index.exists? :type => 'tweet'index.delete
本文由用戶 pdce 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!