Пример #1
0
        public static ElasticsearchResponse <TTo> CloneFrom <TTo>(IElasticsearchResponse from, TTo to)
        {
            var response = new ElasticsearchResponse <TTo>(from.Settings)
            {
                OriginalException = from.OriginalException,
                HttpStatusCode    = from.HttpStatusCode,
                Request           = from.Request,
                RequestMethod     = from.RequestMethod,
                RequestUrl        = from.RequestUrl,
                Response          = to,
                ResponseRaw       = from.ResponseRaw,
                Serializer        = from.Settings.Serializer,
                Settings          = from.Settings,
                Success           = from.Success,
                Metrics           = from.Metrics
            };
            var tt = to as IResponseWithRequestInformation;

            if (tt != null)
            {
                tt.RequestInformation = response;
            }
            return(response);
        }
Пример #2
0
 private static ElasticsearchResponse <DynamicDictionary> ToDynamicResponse(ElasticsearchResponse <Dictionary <string, object> > response)
 {
     return(CloneFrom(response, response.Response != null ? DynamicDictionary.Create(response.Response) : null));
 }
Пример #3
0
 internal static ElasticsearchResponse <DynamicDictionary> Wrap(ElasticsearchResponse <Dictionary <string, object> > response)
 {
     return(ToDynamicResponse(response));
 }