@@ -44,44 +44,5 @@ [U] public void PropertyNamesAreResolvedToLastTokenUsingAppendSuffix()
4444 Expect ( "raw" ) . WhenSerializing < PropertyName > ( expression ) ;
4545 }
4646
47- /**=== Naming conventions
48- * Currently, the name of a field cannot contain a `.` in Elasticsearch due to the potential for ambiguity with
49- * a field that is mapped as a multi field.
50- *
51- * In these cases, NEST allows the call to go to Elasticsearch, deferring the naming conventions to the server side and,
52- * in the case of a `.` in a field name, a `400 Bad Response` is returned with a server error indicating the reason
53- */
54- [ I ] public void PropertyNamesContainingDotsCausesElasticsearchServerError ( )
55- {
56- var createIndexResponse = this . Client . CreateIndex ( "random-" + Guid . NewGuid ( ) . ToString ( ) . ToLowerInvariant ( ) , c => c
57- . Mappings ( m => m
58- . Map ( "type-with-dot" , mm => mm
59- . Properties ( p => p
60- . Text ( s => s
61- . Name ( "name-with.dot" )
62- )
63- )
64- )
65- )
66- ) ;
67-
68- /** The response is not valid */
69- createIndexResponse . ShouldNotBeValid ( ) ;
70-
71- /** `DebugInformation` provides an audit trail of information to help diagnose the issue */
72- createIndexResponse . DebugInformation . Should ( ) . NotBeNullOrEmpty ( ) ;
73-
74- /** `ServerError` contains information about the response from Elasticsearch */
75- createIndexResponse . ServerError . Should ( ) . NotBeNull ( ) ;
76- createIndexResponse . ServerError . Status . Should ( ) . Be ( 400 ) ;
77- createIndexResponse . ServerError . Error . Should ( ) . NotBeNull ( ) ;
78- createIndexResponse . ServerError . Error . RootCause . Should ( ) . NotBeNullOrEmpty ( ) ;
79-
80- var rootCause = createIndexResponse . ServerError . Error . RootCause [ 0 ] ;
81-
82- /** We can see that the underlying reason is a `.` in the field name "name-with.dot" */
83- rootCause . Reason . Should ( ) . Be ( "Field name [name-with.dot] cannot contain '.'" ) ;
84- rootCause . Type . Should ( ) . Be ( "mapper_parsing_exception" ) ;
85- }
8647 }
8748}
0 commit comments