module Elasticord::Client::Create
Constants
- REFRESH_INDEX_AFTER_CREATE
Public Instance Methods
build_params(index, type, attributes)
click to toggle source
# File lib/elasticord/client/create.rb, line 18 def build_params(index, type, attributes) params = { type: type, body: attributes, index: index, refresh: REFRESH_INDEX_AFTER_CREATE } params[:id] = attributes[:id] if attributes[:id] params end
one(elastic_search_client, index, type, attributes = {})
click to toggle source
# File lib/elasticord/client/create.rb, line 8 def one(elastic_search_client, index, type, attributes = {}) params = build_params(index, type, attributes) begin elastic_search_client.index params rescue Elasticsearch::Transport::Transport::Errors::Conflict return false end end