class Lita::Handlers::ElasticsearchIndexer
Public Instance Methods
elasticsearch_client()
click to toggle source
# File lib/lita/handlers/elasticsearch_indexer.rb, line 16 def elasticsearch_client @@elasticsearch_client ||= Elasticsearch::Client.new( urls: config.elasticsearch_url ) end
index_conversation(response)
click to toggle source
# File lib/lita/handlers/elasticsearch_indexer.rb, line 22 def index_conversation(response) user = response.user message = response.message room = message.room_object index_body = { user: {id: user.id, name: user.name}, message: { private: message.private_message?, body: message.body } } index_body[:room] = {id: room.id, name: room.name} if room index_params = { body: index_body }.merge(elasticsearch_index_options(response)) index_params[:index] = config.elasticsearch_index_name index_params[:type] = config.elasticsearch_index_type index = elasticsearch_client.index(index_params) end
Private Instance Methods
elasticsearch_index_options(response)
click to toggle source
# File lib/lita/handlers/elasticsearch_indexer.rb, line 46 def elasticsearch_index_options(response) if config.elasticsearch_index_options config.elasticsearch_index_options.call(response) else {} end end