Exemplo n.º 1
0
        private async Task <List <DocumentSearchResult <T> > > DoAync(ElasticClient client, MultipleQuery <T> query, string path, JsonSerializerSettings jsonSettings, HttpMethod httpMethod, bool returnQueries)
        {
            var indexPattern = $"{client.TenantId}_*";
            var response     = await client.Client.DoRequestAsync <StringResponse>(httpMethod, $"{indexPattern}/{path}", CancellationToken.None, query.ToJson());

            CheckResponse(response);
            var responses = JsonConvert.DeserializeObject <MultipleDocumentSearchResult <T> >(response.Body, jsonSettings);
            var c         = 0;
            var qs        = query.ToArray();

            responses.Resonses.ForEach(result =>
            {
                result._Name = qs[c].Key;
                if (returnQueries)
                {
                    result.Query = qs[c].Value;
                }

                c++;
            });

            return(responses.Resonses);
        }