|
5 | 5 | using System.Linq;
|
6 | 6 | using System.Reactive.Concurrency;
|
7 | 7 | using System.Reactive.Linq;
|
| 8 | +using System.Threading; |
8 | 9 | using System.Threading.Tasks;
|
9 | 10 | using Elasticsearch.Net;
|
10 | 11 | using Microsoft.Extensions.Logging;
|
@@ -77,6 +78,7 @@ private ElasticLowLevelClient CreateNewElasticLowLevelClient(Uri elasticSearchEn
|
77 | 78 | var singleNode = new SingleNodeConnectionPool(_optionsMonitor.CurrentValue.ElasticsearchEndpoint);
|
78 | 79 |
|
79 | 80 | var cc = new ConnectionConfiguration(singleNode, new ElasticsearchJsonNetSerializer())
|
| 81 | + //.ServerCertificateValidationCallback((obj, cert, chain, policyerrors) => true) |
80 | 82 | .EnableHttpPipelining()
|
81 | 83 | .EnableHttpCompression()
|
82 | 84 | .ThrowExceptions();
|
@@ -137,18 +139,20 @@ private async Task WriteDirectlyToESAsBatch(IEnumerable<JObject> jos)
|
137 | 139 | var bb = jos.Zip(indxC, (f, s) => new object[] { s, f });
|
138 | 140 | var bbo = bb.SelectMany(a => a);
|
139 | 141 |
|
140 |
| - try |
141 |
| - { |
142 |
| - //await Client.BulkPutAsync<VoidResponse>(Index, DocumentType, bbo.ToArray(), br => br.Refresh(false)); |
143 |
| - await Client.BulkPutAsync<VoidResponse>(Index, DocumentType, |
144 |
| - PostData.MultiJson(bbo.ToArray()), |
145 |
| - new BulkRequestParameters { Refresh = Refresh.False }); |
146 |
| - } |
147 |
| - catch (Exception) |
148 |
| - { |
149 |
| - //eat the exception, we cant really do much with it anyways |
150 |
| - //Debug.WriteLine(ex.Message); |
151 |
| - } |
| 142 | + _ = Client.BulkPutAsync<VoidResponse>(Index, DocumentType, |
| 143 | + PostData.MultiJson(bbo.ToArray()), |
| 144 | + new BulkRequestParameters { Refresh = Refresh.False }) |
| 145 | + .ContinueWith(x => |
| 146 | + { |
| 147 | + if (x.IsFaulted) |
| 148 | + { |
| 149 | + Debug.WriteLine(x.Exception); |
| 150 | + } |
| 151 | + }, |
| 152 | + CancellationToken.None, |
| 153 | + TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously, |
| 154 | + TaskScheduler.Current); |
| 155 | + |
152 | 156 | }
|
153 | 157 |
|
154 | 158 | private void WriteToQueueForProcessing(JObject jo)
|
|
0 commit comments