@@ -22,47 +22,56 @@ public static void Setup()
2222 var people = NestTestData . People ;
2323 var boolTerms = NestTestData . BoolTerms ;
2424
25- var createIndexResult = client . CreateIndex ( ElasticsearchConfiguration . DefaultIndex , c => c
26- . NumberOfReplicas ( 0 )
27- . NumberOfShards ( 1 )
28- . AddMapping < ElasticsearchProject > ( m => m
29- . MapFromAttributes ( )
30- . Properties ( p => p
31- . String ( s => s . Name ( ep => ep . Content ) . TermVector ( TermVectorOption . WithPositionsOffsetsPayloads ) ) ) )
32- . AddMapping < Person > ( m => m . MapFromAttributes ( ) )
33- . AddMapping < BoolTerm > ( m => m . Properties ( pp=> pp
34- . String ( sm => sm . Name ( p => p . Name1 ) . Index ( FieldIndexOption . NotAnalyzed ) )
35- . String ( sm => sm . Name ( p => p . Name2 ) . Index ( FieldIndexOption . NotAnalyzed ) )
36- ) )
37- ) ;
25+ try
26+ {
27+ var createIndexResult = client . CreateIndex ( ElasticsearchConfiguration . DefaultIndex , c => c
28+ . NumberOfReplicas ( 0 )
29+ . NumberOfShards ( 1 )
30+ . AddMapping < ElasticsearchProject > ( m => m
31+ . MapFromAttributes ( )
32+ . Properties ( p => p
33+ . String ( s => s . Name ( ep => ep . Content ) . TermVector ( TermVectorOption . WithPositionsOffsetsPayloads ) ) ) )
34+ . AddMapping < Person > ( m => m . MapFromAttributes ( ) )
35+ . AddMapping < BoolTerm > ( m => m . Properties ( pp => pp
36+ . String ( sm => sm . Name ( p => p . Name1 ) . Index ( FieldIndexOption . NotAnalyzed ) )
37+ . String ( sm => sm . Name ( p => p . Name2 ) . Index ( FieldIndexOption . NotAnalyzed ) )
38+ ) )
39+ ) ;
3840
39- var createAntotherIndexResult = client . CreateIndex ( ElasticsearchConfiguration . DefaultIndex + "_clone" , c => c
40- . NumberOfReplicas ( 0 )
41- . NumberOfShards ( 1 )
42- . AddMapping < ElasticsearchProject > ( m => m
43- . MapFromAttributes ( )
44- . Properties ( p => p
45- . String ( s => s . Name ( ep => ep . Content ) . TermVector ( TermVectorOption . WithPositionsOffsetsPayloads ) ) ) )
46- . AddMapping < Person > ( m => m . MapFromAttributes ( ) )
47- . AddMapping < BoolTerm > ( m => m . Properties ( pp => pp
48- . String ( sm => sm . Name ( p => p . Name1 ) . Index ( FieldIndexOption . NotAnalyzed ) )
49- . String ( sm => sm . Name ( p => p . Name2 ) . Index ( FieldIndexOption . NotAnalyzed ) )
50- ) )
51- ) ;
41+ var createAntotherIndexResult = client . CreateIndex ( ElasticsearchConfiguration . DefaultIndex + "_clone" , c => c
42+ . NumberOfReplicas ( 0 )
43+ . NumberOfShards ( 1 )
44+ . AddMapping < ElasticsearchProject > ( m => m
45+ . MapFromAttributes ( )
46+ . Properties ( p => p
47+ . String ( s => s . Name ( ep => ep . Content ) . TermVector ( TermVectorOption . WithPositionsOffsetsPayloads ) ) ) )
48+ . AddMapping < Person > ( m => m . MapFromAttributes ( ) )
49+ . AddMapping < BoolTerm > ( m => m . Properties ( pp => pp
50+ . String ( sm => sm . Name ( p => p . Name1 ) . Index ( FieldIndexOption . NotAnalyzed ) )
51+ . String ( sm => sm . Name ( p => p . Name2 ) . Index ( FieldIndexOption . NotAnalyzed ) )
52+ ) )
53+ ) ;
54+
55+ var bulkResponse = client . Bulk ( b => b
56+ . IndexMany ( projects )
57+ . IndexMany ( people )
58+ . IndexMany ( boolTerms )
59+ . Refresh ( )
60+ ) ;
61+ }
62+ catch ( Exception e )
63+ {
64+
65+ throw ;
66+ }
5267
53- var bulkResponse = client . Bulk ( b=> b
54- . IndexMany ( projects )
55- . IndexMany ( people )
56- . IndexMany ( boolTerms )
57- . Refresh ( )
58- ) ;
5968 }
6069
6170 [ TearDown ]
6271 public static void TearDown ( )
6372 {
64- var client = ElasticsearchConfiguration . Client . Value ;
65- client . DeleteIndex ( di => di . Indices ( ElasticsearchConfiguration . DefaultIndex , ElasticsearchConfiguration . DefaultIndex + "_ *" ) ) ;
73+ var client = ElasticsearchConfiguration . Client . Value ;
74+ client . DeleteIndex ( di => di . Indices ( ElasticsearchConfiguration . DefaultIndex , ElasticsearchConfiguration . DefaultIndexPrefix + "*" ) ) ;
6675 }
6776 }
6877}
0 commit comments