public async Task <ActionResult> Index()
        {
            var person = new Person {
                Id        = "1",
                Firstname = "Martijn",
                Lastname  = "Laarman"
            };

            _client.IndexDocument(person);
            _client.IndexMany(new List <Person> {
                person, person, person
            });
            _client.Get <Person>("1");
            _client.DeleteIndex("not-existing-index");
            _client.ClusterHealth();

            using (MiniProfiler.Current.Step("Async")) {
                await _client.IndexDocumentAsync(person);

                using (MiniProfiler.Current.Step("Async inner 1")) {
                    await _client.IndexDocumentAsync(new List <Person> {
                        person, person, person
                    });
                }
                using (MiniProfiler.Current.Step("Async inner 2")) {
                    await _client.IndexManyAsync(new List <Person> {
                        person, person, person
                    });

                    await _client.GetAsync <Person>("1");
                }
            }

            return(View());
        }
        public async Task ProfiledElasticClient_IndexDocument_ProfilerIncludesTimings()
        {
            // Arrange
            var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
            var settings       = new ConnectionSettings(connectionPool, new InMemoryConnection())
                                 .DefaultIndex("test-index");

            var profiler = StackExchangeMiniProfiler.StartNew();
            var client   = new ProfiledElasticClient(settings);
            var person   = new { Id = "1" };

            // Act
            await client.IndexDocumentAsync(person);

            // Assert
            var customTimings = profiler.Root.CustomTimings;

            Assert.Single(customTimings);
            Assert.True(customTimings.TryGetValue("elasticsearch", out var elasticTimings));
            Assert.Single(elasticTimings);
        }