in lib/utility/es_client.rb [65:90]
def raise_if_necessary(response)
if response['errors']
first_error = nil
response['items'].each do |item|
%w[index delete].each do |op|
if item.has_key?(op) && item[op].has_key?('error')
first_error = item
break
end
end
end
if first_error
trace_id = Utility::Logger.generate_trace_id
Utility::Logger.error("Failed to index documents into Elasticsearch. First error in response is: #{first_error.to_json}")
short_message = Utility::Logger.abbreviated_message(first_error.to_json)
raise IndexingFailedError.new("Failed to index documents into Elasticsearch with an error '#{short_message}'. Look up the error ID [#{trace_id}] in the application logs to see the full error message.")
else
raise IndexingFailedError.new('Failed to index documents into Elasticsearch due to unknown error. Try enabling tracing for Elasticsearch and checking the logs.')
end
end
response
end