Class: SlackScratcher::Adapter::Elasticsearch

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_scratcher/adapter/elasticsearch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hosts, metadata) ⇒ Elasticsearch

Returns a new instance of Elasticsearch


8
9
10
11
# File 'lib/slack_scratcher/adapter/elasticsearch.rb', line 8

def initialize(hosts, )
  @client = ::Elasticsearch::Client.new hosts: hosts
  @metadata = 
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


6
7
8
# File 'lib/slack_scratcher/adapter/elasticsearch.rb', line 6

def client
  @client
end

Instance Method Details

#ready_indexObject


24
25
26
27
28
29
# File 'lib/slack_scratcher/adapter/elasticsearch.rb', line 24

def ready_index
  unless index?
    create_index
    put_mapping
  end
end

#send(raw_data) ⇒ Object


13
14
15
16
17
18
# File 'lib/slack_scratcher/adapter/elasticsearch.rb', line 13

def send(raw_data)
  data = format_bulk(raw_data)
  @client.bulk data unless raw_data.empty?
rescue ::Elasticsearch::Transport::Transport::Errors::BadRequest => error
  puts error
end

#timestamp_of_last_channel_log(channel_name) ⇒ Object


20
21
22
# File 'lib/slack_scratcher/adapter/elasticsearch.rb', line 20

def timestamp_of_last_channel_log(channel_name)
  
end