private async Task <ElasticSearchResponse> Search(bool scroll)
        {
            var request = new HttpRequestMessage
            {
                RequestUri = new Uri(_queryEndpoint.Search(scroll)),
                Method     = HttpMethod.Get
            };

            if (!string.IsNullOrWhiteSpace(_queryBody))
            {
                request.Content = new StringContent(_queryBody);
                request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            }
            var result = await _httpClient.SendAsync(request).ConfigureAwait(false);

            result.EnsureSuccessStatusCode();
            var responseBody = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(ElasticSearchResponse.Parse(responseBody));
        }
        public async Task <ElasticSearchResponse> Scroll(ElasticSearchResponse searchResponse)
        {
            var scrollId = searchResponse?.ScrollId;

            if (string.IsNullOrWhiteSpace(scrollId))
            {
                throw new ElasticSearchClientException("Scroll ID Required");
            }
            var url  = _queryEndpoint.Scroll();
            var body = JsonConvert.SerializeObject(new
            {
                scroll    = "1m",
                scroll_id = scrollId
            });
            var content = new StringContent(body, Encoding.UTF8, "application/json");
            var result  = await _httpClient.PostAsync(url, content).ConfigureAwait(false);

            result.EnsureSuccessStatusCode();
            var responseBody = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(ElasticSearchResponse.Parse(responseBody));
        }