Пример #1
0
        public IIndicesStatsResponse IndexStats(string name)
        {
            var indices = Nest.Indices.Index(name);
            var request = new IndicesStatsRequest(indices);

            return(client.IndicesStats(request));
        }
		public IndicesStatsRequestTests()
		{
			var request = new IndicesStatsRequest()
			{
				CompletionFields = new List<PropertyPathMarker> {"name"},
				FielddataFields = new List<PropertyPathMarker> { Property.Path<ElasticsearchProject>(p=>p.PingIP)},
				Metrics = new [] { IndicesStatsMetric.Completion, IndicesStatsMetric.Fielddata}
			};
			var response = this._client.IndicesStats(request);
			this._status = response.ConnectionStatus;
		}
Пример #3
0
        public override async Task <IndexStats> GetStatsAsync(CancellationToken cancellationToken)
        {
            // The request.
            IIndicesStatsRequest request = new IndicesStatsRequest(Indices.Index <T>());

            // Get the response.
            IIndicesStatsResponse response = await ElasticClient
                                             .IndicesStatsAsync(request, cancellationToken).ConfigureAwait(false);

            // If failed, throw.
            response.ThrowIfError();

            // Map and return.
            return(response.Indices[Name].ToElasticsearchIndexStats());
        }
Пример #4
0
        public IndicesStatsRequestTests()
        {
            var request = new IndicesStatsRequest()
            {
                CompletionFields = new List <PropertyPathMarker> {
                    "name"
                },
                FielddataFields = new List <PropertyPathMarker> {
                    Property.Path <ElasticsearchProject>(p => p.PingIP)
                },
                Metrics = new [] { IndicesStatsMetric.Completion, IndicesStatsMetric.Fielddata }
            };
            var response = this._client.IndicesStats(request);

            this._status = response.ConnectionStatus;
        }
Пример #5
0
        [U] public async Task Urls()
        {
            await GET($"/_stats")
            .Request(c => c.IndicesStats(new IndicesStatsRequest()))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest()))
            ;

            await GET($"/_all/_stats")
            .Fluent(c => c.IndicesStats(All))
            .Request(c => c.IndicesStats(new IndicesStatsRequest(All)))
            .FluentAsync(c => c.IndicesStatsAsync(All))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest(All)))
            ;

            var index = "index1,index2";

            await GET($"/index1%2Cindex2/_stats")
            .Fluent(c => c.IndicesStats(index))
            .Request(c => c.IndicesStats(new IndicesStatsRequest(index)))
            .FluentAsync(c => c.IndicesStatsAsync(index))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest(index)))
            ;

            var metrics = IndicesStatsMetric.Completion | IndicesStatsMetric.Flush;

            await GET($"/index1%2Cindex2/_stats/completion%2Cflush")
            .Fluent(c => c.IndicesStats(index, i => i.Metric(metrics)))
            .Request(c => c.IndicesStats(new IndicesStatsRequest(index, metrics)))
            .FluentAsync(c => c.IndicesStatsAsync(index, i => i.Metric(metrics)))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest(index, metrics)))
            ;

            metrics = IndicesStatsMetric.Completion | IndicesStatsMetric.Flush | IndicesStatsMetric.All;
            var request = new IndicesStatsRequest(index, metrics)
            {
            };

            await GET($"/index1%2Cindex2/_stats/_all")
            .Fluent(c => c.IndicesStats(index, i => i.Metric(metrics)))
            .Request(c => c.IndicesStats(request))
            .FluentAsync(c => c.IndicesStatsAsync(index, i => i.Metric(metrics)))
            .RequestAsync(c => c.IndicesStatsAsync(request))
            ;
        }
Пример #6
0
        [U] public async Task Urls()
        {
            await GET($"/_stats")
            .Fluent(c => c.IndicesStats(Nest.Indices.All))
            .Request(c => c.IndicesStats(new IndicesStatsRequest()))
            .FluentAsync(c => c.IndicesStatsAsync(Nest.Indices.All))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest()))
            ;

            var index = "index1,index2";

            await GET($"/index1%2Cindex2/_stats")
            .Fluent(c => c.IndicesStats(index))
            .Request(c => c.IndicesStats(new IndicesStatsRequest(index)))
            .FluentAsync(c => c.IndicesStatsAsync(index))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest(index)))
            ;

            var metrics = IndicesStatsMetric.Completion | IndicesStatsMetric.Flush;

            await GET($"/index1%2Cindex2/_stats/completion%2Cflush")
            .Fluent(c => c.IndicesStats(index, i => i.Metric(metrics)))
            .Request(c => c.IndicesStats(new IndicesStatsRequest(index, metrics)))
            .FluentAsync(c => c.IndicesStatsAsync(index, i => i.Metric(metrics)))
            .RequestAsync(c => c.IndicesStatsAsync(new IndicesStatsRequest(index, metrics)))
            ;

            metrics = IndicesStatsMetric.Completion | IndicesStatsMetric.Flush | IndicesStatsMetric.All;
            var request = new IndicesStatsRequest(index, metrics)
            {
                Types = new TypeName[] { typeof(Project) }
            };

            await GET($"/index1%2Cindex2/_stats/_all?types=doc")
            .Fluent(c => c.IndicesStats(index, i => i.Metric(metrics).Types(typeof(Project))))
            .Request(c => c.IndicesStats(request))
            .FluentAsync(c => c.IndicesStatsAsync(index, i => i.Metric(metrics).Types(typeof(Project))))
            .RequestAsync(c => c.IndicesStatsAsync(request))
            ;
        }