Exemple #1
0
        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 != null)
                {
                    queryString[kv.Key] = resolved;
                }
                else
                {
                    queryString.Remove(kv.Key);
                }
            }
        }
Exemple #2
0
        protected ConnectionConfiguration(IConnectionPool connectionPool, IConnection connection, IElasticsearchSerializer requestResponseSerializer)
        {
            _connectionPool = connectionPool;
            _connection     = connection ?? new HttpConnection();
            UseThisRequestResponseSerializer = requestResponseSerializer ?? new LowLevelRequestResponseSerializer();

            _connectionLimit        = ConnectionConfiguration.DefaultConnectionLimit;
            _requestTimeout         = ConnectionConfiguration.DefaultTimeout;
            _sniffOnConnectionFault = true;
            _sniffOnStartup         = true;
            _sniffLifeSpan          = TimeSpan.FromHours(1);
            if (_connectionPool.SupportsReseeding)
            {
                _nodePredicate = DefaultReseedableNodePredicate;
            }

            _urlFormatter = new ElasticsearchUrlFormatter(this);
        }