@@ -10,15 +10,17 @@ namespace Nest.Tests.Integration.Core.Bulk
1010 [ TestFixture ]
1111 public class BulkTests : IntegrationTests
1212 {
13+ private readonly BulkPercolateTests _bulkPercolateTests ;
14+
15+
1316 [ Test ]
1417 public void Bulk ( )
1518 {
16- //Delete so we know the create does not throw an error.
17- this . _client . DeleteIndex ( ElasticsearchConfiguration . DefaultIndex ) ;
1819 var result = this . _client . Bulk ( b => b
1920 . Index < ElasticSearchProject > ( i => i . Object ( new ElasticSearchProject { Id = 2 } ) )
20- . Create < ElasticSearchProject > ( i => i . Object ( new ElasticSearchProject { Id = 3 } ) )
21+ . Create < ElasticSearchProject > ( i => i . Object ( new ElasticSearchProject { Id = 123123 } ) )
2122 . Delete < ElasticSearchProject > ( i => i . Object ( new ElasticSearchProject { Id = 4 } ) )
23+
2224 ) ;
2325 result . Should ( ) . NotBeNull ( ) ;
2426 result . IsValid . Should ( ) . BeTrue ( ) ;
@@ -34,7 +36,7 @@ public void Bulk()
3436 deleteResponses . First ( ) . Type . Should ( ) . BeEquivalentTo ( this . GetTypeNameFor < ElasticSearchProject > ( ) ) ;
3537
3638 createResponses . Should ( ) . HaveCount ( 1 ) ;
37- createResponses . First ( ) . Id . Should ( ) . BeEquivalentTo ( "3 " ) ;
39+ createResponses . First ( ) . Id . Should ( ) . BeEquivalentTo ( "123123 " ) ;
3840 createResponses . First ( ) . Index . Should ( ) . BeEquivalentTo ( ElasticsearchConfiguration . DefaultIndex ) ;
3941 createResponses . First ( ) . Type . Should ( ) . BeEquivalentTo ( this . GetTypeNameFor < ElasticSearchProject > ( ) ) ;
4042
@@ -116,10 +118,8 @@ public void BulkWithFixedIndexOveriddenIndividualy()
116118 [ Test ]
117119 public void BulkAlternativeWayOfWriting ( )
118120 {
119- this . _client . DeleteIndex ( ElasticsearchConfiguration . DefaultIndex ) ;
120-
121121 var descriptor = new BulkDescriptor ( ) ;
122- foreach ( var i in Enumerable . Range ( 0 , 1000 ) )
122+ foreach ( var i in Enumerable . Range ( 3000 , 1000 ) )
123123 descriptor . Index < ElasticSearchProject > ( op => op . Object ( new ElasticSearchProject { Id = i } ) ) ;
124124
125125 var result = this . _client . Bulk ( descriptor ) ;
@@ -129,59 +129,5 @@ public void BulkAlternativeWayOfWriting()
129129 result . Items . Should ( ) . NotBeNull ( ) . And . NotBeEmpty ( ) . And . HaveCount ( 1000 ) . And . OnlyContain ( r => r . OK ) ;
130130
131131 }
132-
133- [ Test ]
134- public void BulkIndexWithPercolate ( )
135- {
136- // register up some percolator queries to test matching
137- var query1 = "bulkindex-test-doc-1" ;
138-
139- this . _client . UnregisterPercolator < ElasticSearchProject > ( query1 ) ;
140-
141- var perc = this . _client . RegisterPercolator < ElasticSearchProject > ( p => p
142- . Name ( query1 )
143- . Query ( q => q
144- . Term ( f => f . Country , "netherlands" )
145- )
146- ) ;
147-
148- var descriptor = new BulkDescriptor ( ) ;
149-
150- // match against any doc
151- descriptor . Index < ElasticSearchProject > ( i => i
152- . Object ( new ElasticSearchProject { Id = 2 , Country = "netherlands" } )
153- . Percolate ( "*" ) // match on any percolated docs
154- ) ;
155-
156- // no percolate requested this time
157- descriptor . Index < ElasticSearchProject > ( i => i
158- . Object ( new ElasticSearchProject { Id = 3 , Country = "netherlands" } )
159- ) ;
160-
161- var result = this . _client . Bulk ( descriptor ) ;
162-
163- result . Should ( ) . NotBeNull ( ) ;
164- result . IsValid . Should ( ) . BeTrue ( ) ;
165-
166- result . Items . Should ( ) . NotBeNull ( ) . And . NotBeEmpty ( ) . And . HaveCount ( 2 ) . And . OnlyContain ( r => r . OK ) ;
167- var indexResponses = result . Items . OfType < BulkIndexResponseItem > ( ) ;
168-
169- // tests on percolated responses
170- indexResponses . Should ( ) . HaveCount ( 2 ) ;
171-
172- indexResponses . First ( ) . Id . Should ( ) . BeEquivalentTo ( "2" ) ;
173- indexResponses . First ( ) . Index . Should ( ) . BeEquivalentTo ( ElasticsearchConfiguration . DefaultIndex ) ;
174- indexResponses . First ( ) . Type . Should ( ) . BeEquivalentTo ( this . GetTypeNameFor < ElasticSearchProject > ( ) ) ;
175- indexResponses . First ( ) . Matches . Should ( ) . NotBeNull ( ) ;
176-
177- indexResponses . ElementAt ( 1 ) . Id . Should ( ) . BeEquivalentTo ( "3" ) ;
178- indexResponses . ElementAt ( 1 ) . Index . Should ( ) . BeEquivalentTo ( ElasticsearchConfiguration . DefaultIndex ) ;
179- indexResponses . ElementAt ( 1 ) . Type . Should ( ) . BeEquivalentTo ( this . GetTypeNameFor < ElasticSearchProject > ( ) ) ;
180- indexResponses . First ( ) . Matches . Should ( ) . BeNull ( ) ;
181-
182- // cleanup
183- this . _client . UnregisterPercolator < ElasticSearchProject > ( query1 ) ;
184- }
185-
186132 }
187133}
0 commit comments