private void IndexLog(string jsonBody, DateTime timestamp, string logType, string lineId) { var indexName = BuildIndexName(timestamp).ToLowerInvariant(); EnsureIndexExists(indexName); var indexResult = _rawClient.IndexPut(lineId, indexName, logType, jsonBody, qs => { if (!string.IsNullOrWhiteSpace(_configuration.Ttl)) { qs.Add("ttl", _configuration.Ttl); } return(qs); }); if (!indexResult.Success) { throw new ApplicationException(string.Format("Failed to index: '{0}'. Result: '{1}'.", jsonBody, indexResult.Result)); } Log.Trace(string.Format("{0}: ({1}) Indexed successfully.", LogContext.LogType, lineId)); }