@@ -113,7 +113,7 @@ public void testIndex() throws Exception {
113
113
.source (jsonMap ); // <1>
114
114
//end::index-request-map
115
115
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
116
- assertEquals (indexResponse . getResult (), DocWriteResponse .Result .CREATED );
116
+ assertEquals (DocWriteResponse .Result .CREATED , indexResponse . getResult () );
117
117
}
118
118
{
119
119
//tag::index-request-xcontent
@@ -129,7 +129,7 @@ public void testIndex() throws Exception {
129
129
.source (builder ); // <1>
130
130
//end::index-request-xcontent
131
131
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
132
- assertEquals (indexResponse . getResult (), DocWriteResponse .Result .UPDATED );
132
+ assertEquals (DocWriteResponse .Result .UPDATED , indexResponse . getResult () );
133
133
}
134
134
{
135
135
//tag::index-request-shortcut
@@ -139,7 +139,7 @@ public void testIndex() throws Exception {
139
139
"message" , "trying out Elasticsearch" ); // <1>
140
140
//end::index-request-shortcut
141
141
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
142
- assertEquals (indexResponse . getResult (), DocWriteResponse .Result .UPDATED );
142
+ assertEquals (DocWriteResponse .Result .UPDATED , indexResponse . getResult () );
143
143
}
144
144
{
145
145
//tag::index-request-string
@@ -158,7 +158,7 @@ public void testIndex() throws Exception {
158
158
// tag::index-execute
159
159
IndexResponse indexResponse = client .index (request , RequestOptions .DEFAULT );
160
160
// end::index-execute
161
- assertEquals (indexResponse . getResult (), DocWriteResponse .Result .UPDATED );
161
+ assertEquals (DocWriteResponse .Result .UPDATED , indexResponse . getResult () );
162
162
163
163
// tag::index-response
164
164
String index = indexResponse .getIndex ();
@@ -269,7 +269,7 @@ public void testUpdate() throws Exception {
269
269
{
270
270
IndexRequest indexRequest = new IndexRequest ("posts" , "doc" , "1" ).source ("field" , 0 );
271
271
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
272
- assertSame (indexResponse .status (), RestStatus . CREATED );
272
+ assertSame (RestStatus . CREATED , indexResponse .status ());
273
273
274
274
Request request = new Request ("POST" , "/_scripts/increment-field" );
275
275
request .setJsonEntity (Strings .toString (JsonXContent .contentBuilder ()
@@ -280,7 +280,7 @@ public void testUpdate() throws Exception {
280
280
.endObject ()
281
281
.endObject ()));
282
282
Response response = client ().performRequest (request );
283
- assertEquals (response . getStatusLine (). getStatusCode (), RestStatus . OK . getStatus ());
283
+ assertEquals (RestStatus . OK . getStatus (), response . getStatusLine (). getStatusCode ());
284
284
}
285
285
{
286
286
//tag::update-request
@@ -298,7 +298,7 @@ public void testUpdate() throws Exception {
298
298
request .script (inline ); // <3>
299
299
//end::update-request-with-inline-script
300
300
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
301
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
301
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
302
302
assertEquals (4 , updateResponse .getGetResult ().getSource ().get ("field" ));
303
303
304
304
request = new UpdateRequest ("posts" , "doc" , "1" ).fetchSource (true );
@@ -308,7 +308,7 @@ public void testUpdate() throws Exception {
308
308
request .script (stored ); // <2>
309
309
//end::update-request-with-stored-script
310
310
updateResponse = client .update (request , RequestOptions .DEFAULT );
311
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
311
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
312
312
assertEquals (8 , updateResponse .getGetResult ().getSource ().get ("field" ));
313
313
}
314
314
{
@@ -320,7 +320,7 @@ public void testUpdate() throws Exception {
320
320
.doc (jsonMap ); // <1>
321
321
//end::update-request-with-doc-as-map
322
322
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
323
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
323
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
324
324
}
325
325
{
326
326
//tag::update-request-with-doc-as-xcontent
@@ -335,7 +335,7 @@ public void testUpdate() throws Exception {
335
335
.doc (builder ); // <1>
336
336
//end::update-request-with-doc-as-xcontent
337
337
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
338
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
338
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
339
339
}
340
340
{
341
341
//tag::update-request-shortcut
@@ -344,7 +344,7 @@ public void testUpdate() throws Exception {
344
344
"reason" , "daily update" ); // <1>
345
345
//end::update-request-shortcut
346
346
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
347
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
347
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
348
348
}
349
349
{
350
350
//tag::update-request-with-doc-as-string
@@ -359,7 +359,7 @@ public void testUpdate() throws Exception {
359
359
// tag::update-execute
360
360
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
361
361
// end::update-execute
362
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
362
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
363
363
364
364
// tag::update-response
365
365
String index = updateResponse .getIndex ();
@@ -434,7 +434,7 @@ public void testUpdate() throws Exception {
434
434
request .fetchSource (true ); // <1>
435
435
//end::update-request-no-source
436
436
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
437
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
437
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
438
438
assertNotNull (updateResponse .getGetResult ());
439
439
assertEquals (3 , updateResponse .getGetResult ().sourceAsMap ().size ());
440
440
}
@@ -446,7 +446,7 @@ public void testUpdate() throws Exception {
446
446
request .fetchSource (new FetchSourceContext (true , includes , excludes )); // <1>
447
447
//end::update-request-source-include
448
448
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
449
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
449
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
450
450
Map <String , Object > sourceAsMap = updateResponse .getGetResult ().sourceAsMap ();
451
451
assertEquals (2 , sourceAsMap .size ());
452
452
assertEquals ("source includes" , sourceAsMap .get ("reason" ));
@@ -460,7 +460,7 @@ public void testUpdate() throws Exception {
460
460
request .fetchSource (new FetchSourceContext (true , includes , excludes )); // <1>
461
461
//end::update-request-source-exclude
462
462
UpdateResponse updateResponse = client .update (request , RequestOptions .DEFAULT );
463
- assertEquals (updateResponse . getResult (), DocWriteResponse .Result .UPDATED );
463
+ assertEquals (DocWriteResponse .Result .UPDATED , updateResponse . getResult () );
464
464
Map <String , Object > sourceAsMap = updateResponse .getGetResult ().sourceAsMap ();
465
465
assertEquals (2 , sourceAsMap .size ());
466
466
assertEquals ("source excludes" , sourceAsMap .get ("reason" ));
@@ -538,7 +538,7 @@ public void testDelete() throws Exception {
538
538
{
539
539
IndexRequest indexRequest = new IndexRequest ("posts" , "doc" , "1" ).source ("field" , "value" );
540
540
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
541
- assertSame (indexResponse .status (), RestStatus . CREATED );
541
+ assertSame (RestStatus . CREATED , indexResponse .status ());
542
542
}
543
543
544
544
{
@@ -552,7 +552,7 @@ public void testDelete() throws Exception {
552
552
// tag::delete-execute
553
553
DeleteResponse deleteResponse = client .delete (request , RequestOptions .DEFAULT );
554
554
// end::delete-execute
555
- assertSame (deleteResponse . getResult (), DocWriteResponse .Result .DELETED );
555
+ assertSame (DocWriteResponse .Result .DELETED , deleteResponse . getResult () );
556
556
557
557
// tag::delete-response
558
558
String index = deleteResponse .getIndex ();
@@ -605,7 +605,7 @@ public void testDelete() throws Exception {
605
605
{
606
606
IndexResponse indexResponse = client .index (new IndexRequest ("posts" , "doc" , "1" ).source ("field" , "value" )
607
607
, RequestOptions .DEFAULT );
608
- assertSame (indexResponse .status (), RestStatus . CREATED );
608
+ assertSame (RestStatus . CREATED , indexResponse .status ());
609
609
610
610
// tag::delete-conflict
611
611
try {
@@ -621,7 +621,7 @@ public void testDelete() throws Exception {
621
621
{
622
622
IndexResponse indexResponse = client .index (new IndexRequest ("posts" , "doc" , "async" ).source ("field" , "value" ),
623
623
RequestOptions .DEFAULT );
624
- assertSame (indexResponse .status (), RestStatus . CREATED );
624
+ assertSame (RestStatus . CREATED , indexResponse .status ());
625
625
626
626
DeleteRequest request = new DeleteRequest ("posts" , "doc" , "async" );
627
627
@@ -666,7 +666,7 @@ public void testBulk() throws Exception {
666
666
// tag::bulk-execute
667
667
BulkResponse bulkResponse = client .bulk (request , RequestOptions .DEFAULT );
668
668
// end::bulk-execute
669
- assertSame (bulkResponse .status (), RestStatus . OK );
669
+ assertSame (RestStatus . OK , bulkResponse .status ());
670
670
assertFalse (bulkResponse .hasFailures ());
671
671
}
672
672
{
@@ -679,7 +679,7 @@ public void testBulk() throws Exception {
679
679
.source (XContentType .JSON ,"field" , "baz" ));
680
680
// end::bulk-request-with-mixed-operations
681
681
BulkResponse bulkResponse = client .bulk (request , RequestOptions .DEFAULT );
682
- assertSame (bulkResponse .status (), RestStatus . OK );
682
+ assertSame (RestStatus . OK , bulkResponse .status ());
683
683
assertFalse (bulkResponse .hasFailures ());
684
684
685
685
// tag::bulk-response
@@ -778,7 +778,7 @@ public void testGet() throws Exception {
778
778
"postDate" , new Date (),
779
779
"message" , "trying out Elasticsearch" );
780
780
IndexResponse indexResponse = client .index (indexRequest , RequestOptions .DEFAULT );
781
- assertEquals (indexResponse . getResult (), DocWriteResponse .Result .CREATED );
781
+ assertEquals (DocWriteResponse .Result .CREATED , indexResponse . getResult () );
782
782
}
783
783
{
784
784
//tag::get-request
0 commit comments