1- using System ;
2- using System . Collections . Concurrent ;
1+ using System ;
32using System . Collections . Generic ;
4- using System . Collections . ObjectModel ;
53using System . Linq ;
6- using System . Security . Cryptography . X509Certificates ;
74using System . Text ;
8- using System . Text . RegularExpressions ;
9- using System . Threading ;
105using Elasticsearch . Net ;
116using Nest . Resolvers ;
127using Nest . Resolvers . Converters ;
138using Newtonsoft . Json ;
14- using Newtonsoft . Json . Converters ;
15- using Newtonsoft . Json . Linq ;
169
1710namespace Nest
1811{
19- public interface INestSerializer : IElasticsearchSerializer
20- {
21- IQueryResponse < TResult > DeserializeSearchResponse < T , TResult > ( ElasticsearchResponse status , SearchDescriptor < T > originalSearchDescriptor )
22- where TResult : class
23- where T : class ;
24-
25- string SerializeBulkDescriptor ( BulkDescriptor bulkDescriptor ) ;
26-
27- /// <summary>
28- /// _msearch needs a specialized json format in the body
29- /// </summary>
30- string SerializeMultiSearch ( MultiSearchDescriptor multiSearchDescriptor ) ;
31-
32- TemplateResponse DeserializeTemplateResponse ( ElasticsearchResponse c , GetTemplateDescriptor d ) ;
33- GetMappingResponse DeserializeGetMappingResponse ( ElasticsearchResponse c ) ;
34- MultiGetResponse DeserializeMultiGetResponse ( ElasticsearchResponse c , MultiGetDescriptor d ) ;
35- MultiSearchResponse DeserializeMultiSearchResponse ( ElasticsearchResponse c , MultiSearchDescriptor d ) ;
36- WarmerResponse DeserializeWarmerResponse ( ElasticsearchResponse connectionStatus , GetWarmerDescriptor getWarmerDescriptor ) ;
37-
38- /// <summary>
39- /// Returns a response of type R based on the connection status by trying parsing status.Result into R
40- /// </summary>
41- R ToParsedResponse < R > (
42- ElasticsearchResponse status ,
43- bool notFoundIsAValidResponse = false ,
44- JsonConverter piggyBackJsonConverter = null
45- ) where R : BaseResponse ;
46- }
47-
4812 public class NestSerializer : INestSerializer
4913 {
5014 private readonly IConnectionSettingsValues _settings ;
@@ -72,9 +36,9 @@ public virtual R ToParsedResponse<R>(
7236
7337 var isValid =
7438 ( notFoundIsAValidResponse )
75- ? ( status . Error == null
76- || status . Error . HttpStatusCode == System . Net . HttpStatusCode . NotFound )
77- : ( status . Error == null ) ;
39+ ? ( status . Error == null
40+ || status . Error . HttpStatusCode == System . Net . HttpStatusCode . NotFound )
41+ : ( status . Error == null ) ;
7842
7943 R r ;
8044 if ( ! isValid )
@@ -162,11 +126,11 @@ public string SerializeBulkDescriptor(BulkDescriptor bulkDescriptor)
162126 {
163127 var command = operation . _Operation ;
164128 var index = operation . _Index
165- ?? inferrer . IndexName ( bulkDescriptor . _Index )
166- ?? inferrer . IndexName ( operation . _ClrType ) ;
129+ ?? inferrer . IndexName ( bulkDescriptor . _Index )
130+ ?? inferrer . IndexName ( operation . _ClrType ) ;
167131 var typeName = operation . _Type
168- ?? inferrer . TypeName ( bulkDescriptor . _Type )
169- ?? inferrer . TypeName ( operation . _ClrType ) ;
132+ ?? inferrer . TypeName ( bulkDescriptor . _Type )
133+ ?? inferrer . TypeName ( operation . _ClrType ) ;
170134
171135 var id = operation . GetIdForObject ( inferrer ) ;
172136 operation . _Index = index ;
@@ -207,13 +171,13 @@ public string SerializeMultiSearch(MultiSearchDescriptor multiSearchDescriptor)
207171 indices = "_all" ;
208172
209173 var index = indices
210- ?? inferrer . IndexName ( multiSearchDescriptor . _Index )
211- ?? inferrer . IndexName ( operation . _ClrType ) ;
174+ ?? inferrer . IndexName ( multiSearchDescriptor . _Index )
175+ ?? inferrer . IndexName ( operation . _ClrType ) ;
212176
213177 var types = inferrer . TypeNames ( operation . _Types ) ;
214178 var typeName = types
215- ?? inferrer . TypeName ( multiSearchDescriptor . _Type )
216- ?? inferrer . TypeName ( operation . _ClrType ) ;
179+ ?? inferrer . TypeName ( multiSearchDescriptor . _Type )
180+ ?? inferrer . TypeName ( operation . _ClrType ) ;
217181 if ( operation . _AllTypes . GetValueOrDefault ( false ) )
218182 typeName = null ; //force empty typename so we'll query all types.
219183
@@ -331,4 +295,4 @@ protected string GetSearchType(SearchDescriptorBase descriptor, MultiSearchDescr
331295 }
332296
333297 }
334- }
298+ }
0 commit comments