Elastomer-ClientElasticsearch 的交互庫
Elastomer-Client 為 ElasticSearch API endpoint 提供一個(gè)一對(duì)一的映射。API 通過你想要實(shí)現(xiàn)的來分解為邏輯部分和訪問,每一個(gè)邏輯部分代表一個(gè)客戶端類。
示例代碼:
require 'elastomer/client'
client = Elastomer::Client.new
index = client.index('twitter')
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評(píng)論
圖片
表情
