File tree 3 files changed +15
-3
lines changed
CommonAbstractions/Infer/Id
Tests/Document/Single/Index
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ internal string GetString(IConnectionSettingsValues nestSettings)
30
30
{
31
31
if ( this . Document != null )
32
32
{
33
- return nestSettings . Inferrer . Id ( this . Document ) ;
33
+ Value = nestSettings . Inferrer . Id ( this . Document ) ;
34
34
}
35
35
36
36
var s = Value as string ;
Original file line number Diff line number Diff line change @@ -17,18 +17,20 @@ public partial interface IIndexRequest<TDocument> : IIndexRequest where TDocumen
17
17
public partial class IndexRequest < TDocument >
18
18
where TDocument : class
19
19
{
20
- protected override HttpMethod HttpMethod => ( ( IIndexRequest < TDocument > ) this ) . Id == null ? HttpMethod . POST : HttpMethod . PUT ;
20
+ protected override HttpMethod HttpMethod => GetHttpMethod ( this ) ;
21
21
22
22
partial void DocumentFromPath ( TDocument doc ) => this . Document = doc ;
23
23
24
24
object IIndexRequest . UntypedDocument => this . Document ;
25
25
26
26
public TDocument Document { get ; set ; }
27
+
28
+ internal static HttpMethod GetHttpMethod ( IIndexRequest < TDocument > r ) => ( r . Id != null && r . Id . Value != null ) ? HttpMethod . PUT : HttpMethod . POST ;
27
29
}
28
30
29
31
public partial class IndexDescriptor < TDocument > where TDocument : class
30
32
{
31
- protected override HttpMethod HttpMethod => Self . Id == null ? HttpMethod . POST : HttpMethod . PUT ;
33
+ protected override HttpMethod HttpMethod => IndexRequest < TDocument > . GetHttpMethod ( this ) ;
32
34
partial void DocumentFromPath ( TDocument doc ) => Assign ( a => a . Document = doc ) ;
33
35
object IIndexRequest . UntypedDocument => Self . Document ;
34
36
Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ await POST("/project/project")
22
22
} ) )
23
23
;
24
24
25
+ await POST ( "/project/project" )
26
+ . Fluent ( c => c . Index ( new { } , i => i . Index ( typeof ( Project ) ) . Type ( typeof ( Project ) ) ) )
27
+ . Request ( c => c . Index ( new IndexRequest < object > ( "project" , "project" ) { Document = new { } } ) )
28
+ . FluentAsync ( c => c . IndexAsync ( new { } , i => i . Index ( typeof ( Project ) ) . Type ( typeof ( Project ) ) ) )
29
+ . RequestAsync ( c => c . IndexAsync ( new IndexRequest < object > ( typeof ( Project ) , TypeName . From < Project > ( ) )
30
+ {
31
+ Document = new { }
32
+ } ) )
33
+ ;
34
+
25
35
await PUT ( "/project/project/NEST" )
26
36
. Fluent ( c => c . Index ( project ) )
27
37
. Request ( c => c . Index ( new IndexRequest < Project > ( "project" , "project" , "NEST" ) { Document = project } ) )
You can’t perform that action at this time.
0 commit comments