Skip to content

Commit

Permalink
Merge pull request #63 from amccool/reduce-response-size
Browse files Browse the repository at this point in the history
actually use the allow insecure HTTPS
  • Loading branch information
amccool committed Nov 10, 2021
2 parents b22ee4b + 8307ec8 commit e7ad0c0
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private ElasticLowLevelClient CreateNewElasticLowLevelClient(Uri elasticSearchEn
var singleNode = new SingleNodeConnectionPool(_optionsMonitor.CurrentValue.ElasticsearchEndpoint);

var cc = new ConnectionConfiguration(singleNode, new ElasticsearchJsonNetSerializer())
//.ServerCertificateValidationCallback((obj, cert, chain, policyerrors) => true)
.ServerCertificateValidationCallback((obj, cert, chain, policyerrors) => true)
.EnableHttpPipelining()
.EnableHttpCompression()
.ThrowExceptions();
Expand All @@ -88,15 +88,15 @@ private ElasticLowLevelClient CreateNewElasticLowLevelClient(Uri elasticSearchEn

private void Initialize()
{
//setup a flag in config to chose
//TODO: setup a flag in config to chose
//SetupObserver();
SetupObserverBatchy();
}


private void SetupObserver()
{
_scribeProcessor = a => WriteDirectlyToES(a);
_scribeProcessor = async (a) => await WriteDirectlyToES(a);

//this._queueToBePosted.GetConsumingEnumerable()
//.ToObservable(Scheduler.Default)
Expand Down Expand Up @@ -128,6 +128,9 @@ private async Task WriteDirectlyToES(JObject jo)
}
}

//POST /_bulk? filter_path = items.*.error
private static Dictionary<string, object> filter_path = new Dictionary<string, object>() { { "filter_path", "items.*.error" } };

private async Task WriteDirectlyToESAsBatch(IEnumerable<JObject> jos)
{
if (!jos.Any())
Expand All @@ -141,7 +144,7 @@ private async Task WriteDirectlyToESAsBatch(IEnumerable<JObject> jos)

_ = Client.BulkPutAsync<VoidResponse>(Index, DocumentType,
PostData.MultiJson(bbo.ToArray()),
new BulkRequestParameters { Refresh = Refresh.False })
new BulkRequestParameters { Refresh = Refresh.False, QueryString=filter_path })
.ContinueWith(x =>
{
if (x.IsFaulted)
Expand Down

0 comments on commit e7ad0c0

Please sign in to comment.