コード例 #1
0
        private string CreatePathWithQueryStrings(string path, IConnectionConfigurationValues global, IRequestParameters request = null)
        {
            //Make sure we append global query string as well the request specific query string parameters
            var copy      = new NameValueCollection(global.QueryStringParameters);
            var formatter = new UrlFormatProvider(this.ConnectionSettings);

            if (request != null)
            {
                copy.Add(request.QueryString.ToNameValueCollection(formatter));
            }
            if (!copy.HasKeys())
            {
                return(path);
            }

            var queryString = copy.ToQueryString();
            var tempUri     = new Uri("http://localhost:9200/" + path).Purify();

            if (tempUri.Query.IsNullOrEmpty())
            {
                path += queryString;
            }
            else
            {
                path += "&" + queryString.Substring(1, queryString.Length - 1);
            }
            return(path);
        }
コード例 #2
0
        /// <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 = new UrlFormatProvider(this.Transport.Settings);
        }
コード例 #3
0
        private string CreatePathWithQueryStrings(string path, IConnectionConfigurationValues global, IRequestParameters request = null)
        {
            //Make sure we append global query string as well the request specific query string parameters
            var copy      = new NameValueCollection(global.QueryStringParameters);
            var formatter = new UrlFormatProvider(this.ConnectionSettings);

            if (request != null)
            {
                copy.Add(request.QueryString.ToNameValueCollection(formatter));
            }
            if (!copy.HasKeys())
            {
                return(path);
            }

            var queryString = copy.ToQueryString();

            path += queryString;
            return(path);
        }
コード例 #4
0
		private string CreatePathWithQueryStrings(string path, IConnectionConfigurationValues global, IRequestParameters request = null)
		{

			//Make sure we append global query string as well the request specific query string parameters
			var copy = new NameValueCollection(global.QueryStringParameters);
			var formatter = new UrlFormatProvider(this.ConnectionSettings);
			if (request != null)
				copy.Add(request.QueryString.ToNameValueCollection(formatter));
			if (!copy.HasKeys()) return path;

			var queryString = copy.ToQueryString();
			var tempUri = new Uri("http://localhost:9200/" + path).Purify();
			if (tempUri.Query.IsNullOrEmpty())
				path += queryString;
			else 
				path += "&" + queryString.Substring(1, queryString.Length - 1);
			return path;
		}
コード例 #5
0
		private string CreatePathWithQueryStrings(string path, IConnectionConfigurationValues global, IRequestParameters request = null)
		{
			//Make sure we append global query string as well the request specific query string parameters
			var copy = new NameValueCollection(global.QueryStringParameters);
			var formatter = new UrlFormatProvider(this.ConnectionSettings);
			if (request != null)
				copy.Add(request.QueryString.ToNameValueCollection(formatter));
			if (!copy.HasKeys()) return path;

			var queryString = copy.ToQueryString();
			path += queryString;
			return path;
		}