internal static void UpdateFromDictionary(this NameValueCollection queryString, Dictionary <string, object> queryStringUpdates, ElasticsearchUrlFormatter provider ) { if (queryString == null || queryString.Count < 0) { return; } if (queryStringUpdates == null || queryStringUpdates.Count < 0) { return; } foreach (var kv in queryStringUpdates.Where(kv => !kv.Key.IsNullOrEmpty())) { if (kv.Value == null) { queryString.Remove(kv.Key); continue; } var resolved = provider.CreateString(kv.Value); if (!resolved.IsNullOrEmpty()) { queryString[kv.Key] = resolved; } else { queryString.Remove(kv.Key); } } }
/// <summary> /// Instantiate a new low level elasticsearch client explicitly specifying a custom transport setup /// </summary> public ElasticLowLevelClient(ITransport <IConnectionConfigurationValues> transport) { transport.ThrowIfNull(nameof(transport)); transport.Settings.ThrowIfNull(nameof(transport.Settings)); transport.Settings.RequestResponseSerializer.ThrowIfNull(nameof(transport.Settings.RequestResponseSerializer)); this.Transport = transport; this._formatter = this.Transport.Settings.UrlFormatter; }