Example #1
0
        /// <summary>
        /// Gets only the specified stats for all the indices
        /// </summary>
        public IGlobalStatsResponse Stats(StatsParams parameters)
        {
            var status = this.Connection.GetSync(this._BuildStatsUrl(parameters));
            var r      = this.ToParsedResponse <GlobalStatsResponse>(status);

            return(r);
        }
Example #2
0
        private string _BuildStatsUrl(StatsParams parameters)
        {
            var path = "_stats";

            if (parameters == null)
            {
                return(path);
            }

            var info = parameters.InfoOn;

            if (info != StatsInfo.None)
            {
                path += "?clear=true";
                var isAll   = (info & StatsInfo.All) == StatsInfo.All;
                var options = new List <string>();
                if (isAll || (info & StatsInfo.Docs) == StatsInfo.Docs)
                {
                    options.Add("docs=true");
                }
                if (isAll || (info & StatsInfo.Store) == StatsInfo.Store)
                {
                    options.Add("store=true");
                }
                if (isAll || (info & StatsInfo.Indexing) == StatsInfo.Indexing)
                {
                    options.Add("indexing=true");
                }
                if (isAll || (info & StatsInfo.Get) == StatsInfo.Get)
                {
                    options.Add("get=true");
                }
                if (isAll || (info & StatsInfo.Search) == StatsInfo.Search)
                {
                    options.Add("search=true");
                }
                if (isAll || (info & StatsInfo.Merge) == StatsInfo.Merge)
                {
                    options.Add("merge=true");
                }
                if (isAll || (info & StatsInfo.Flush) == StatsInfo.Flush)
                {
                    options.Add("flush=true");
                }
                path += "&" + string.Join("&", options);
            }
            if (parameters.Refresh)
            {
                path += "&refresh=true";
            }
            if (parameters.Types != null && parameters.Types.Any())
            {
                path += "&types=" + string.Join(",", parameters.Types);
            }
            if (parameters.Groups != null && parameters.Groups.Any())
            {
                path += "&groups=" + string.Join(",", parameters.Groups);
            }
            return(path);
        }
Example #3
0
        /// <summary>
        /// Gets the specified stats for the specified indices
        /// </summary>
        public StatsResponse Stats(IEnumerable <string> indices, StatsParams parameters)
        {
            indices.ThrowIfEmpty("indices");
            var path   = this.CreatePath(string.Join(",", indices)) + this._BuildStatsUrl(parameters);
            var status = this.Connection.GetSync(path);
            var r      = this.ToParsedResponse <StatsResponse>(status);

            return(r);
        }
Example #4
0
        /// <summary>
        /// Gets the specified stats for the specified indices
        /// </summary>
        public IStatsResponse Stats(IEnumerable <string> indices, StatsParams parameters)
        {
            indices.ThrowIfEmpty("indices");
            var path   = this.PathResolver.CreateIndexPath(indices, this._BuildStatsUrl(parameters));
            var status = this.Connection.GetSync(path);
            var r      = this.ToParsedResponse <StatsResponse>(status);

            return(r);
        }
Example #5
0
        public StatsResponse Stats(string index, StatsParams parameters)
        {
            index.ThrowIfNull("index");
            var path   = this.CreatePath(index) + this._BuildStatsUrl(parameters);
            var status = this.Connection.GetSync(path);
            var r      = this.ToParsedResponse <StatsResponse>(status);

            return(r);
        }