From 89b97b23c4a0b858c05f0406901116a97fec2a39 Mon Sep 17 00:00:00 2001
From: Rolf Kristensen <sweaty1@hotmail.com>
Date: Tue, 4 Dec 2018 22:00:36 +0100
Subject: [PATCH] Updated Elasticsearch.Net to ver. 6.1.0

---
 .../ElasticSearchTarget.cs                     | 18 +++++++++++++++++-
 .../NLog.Targets.ElasticSearch.csproj          |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs b/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs
index 1d4dfdd..03827e9 100644
--- a/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs
+++ b/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs
@@ -60,6 +60,16 @@ static JsonSerializerSettings CreateJsonSerializerSettings()
         /// </summary>
         public bool DisableAutomaticProxyDetection { get; set; }
 
+        /// <summary>
+        /// Set it to true to disable use of ping to checking if node is alive
+        /// </summary>
+        public bool DisablePing { get; set; }
+
+        /// <summary>
+        /// Set it to true to enable HttpCompression (Must be enabled on server)
+        /// </summary>
+        public bool EnableHttpCompression { get; set; }
+
         /// <summary>
         /// Gets or sets the name of the elasticsearch index to write to.
         /// </summary>
@@ -130,6 +140,12 @@ protected override void InitializeTarget()
             if (DisableAutomaticProxyDetection)
                 config.DisableAutomaticProxyDetection();
 
+            if (DisablePing)
+                config.DisablePing();
+
+            if (EnableHttpCompression)
+                config.EnableHttpCompression();
+
             _client = new ElasticLowLevelClient(config);
 
             if (!string.IsNullOrEmpty(ExcludedProperties))
@@ -146,7 +162,7 @@ protected override void Write(IList<AsyncLogEventInfo> logEvents)
             SendBatch(logEvents);
         }
 
-        private void SendBatch(IList<AsyncLogEventInfo> logEvents)
+        private void SendBatch(ICollection<AsyncLogEventInfo> logEvents)
         {
             try
             {
diff --git a/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj b/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj
index 66ac575..2f0550a 100644
--- a/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj
+++ b/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj
@@ -12,7 +12,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Elasticsearch.Net" Version="6.0.2" />
+    <PackageReference Include="Elasticsearch.Net" Version="6.1.0" />
     <PackageReference Include="NLog" Version="4.5.0" />
   </ItemGroup>