@@ -448,7 +448,6 @@ mod integration_tests {
448
448
topology:: config:: SinkConfig ,
449
449
Event ,
450
450
} ;
451
- use elastic:: client:: SyncClientBuilder ;
452
451
use futures:: { Future , Sink } ;
453
452
use hyper:: { Body , Request } ;
454
453
use serde_json:: { json, Value } ;
@@ -459,7 +458,7 @@ mod integration_tests {
459
458
fn structures_events_correctly ( ) {
460
459
let index = gen_index ( ) ;
461
460
let config = ElasticSearchConfig {
462
- host : "http://localhost:9200/ " . into ( ) ,
461
+ host : "http://localhost:9200" . into ( ) ,
463
462
index : Some ( index. clone ( ) ) ,
464
463
doc_type : Some ( "log_lines" . into ( ) ) ,
465
464
id_key : Some ( "my_id" . into ( ) ) ,
@@ -484,20 +483,23 @@ mod integration_tests {
484
483
// make sure writes all all visible
485
484
block_on ( flush ( & config) ) . unwrap ( ) ;
486
485
487
- let client = SyncClientBuilder :: new ( ) . build ( ) . unwrap ( ) ;
488
-
489
- let response = client
490
- . search :: < Value > ( )
491
- . index ( index)
492
- . body ( json ! ( {
486
+ let response = reqwest:: Client :: new ( )
487
+ . get ( & format ! ( "{}/{}/_search" , config. host, index) )
488
+ . json ( & json ! ( {
493
489
"query" : { "query_string" : { "query" : "*" } }
494
490
} ) )
495
491
. send ( )
492
+ . unwrap ( )
493
+ . json :: < elastic_responses:: search:: SearchResponse < Value > > ( )
496
494
. unwrap ( ) ;
495
+
496
+ println ! ( "response {:?}" , response) ;
497
+
497
498
assert_eq ! ( 1 , response. total( ) ) ;
498
499
499
500
let hit = response. into_hits ( ) . next ( ) . unwrap ( ) ;
500
- assert_eq ! ( "42" , hit. id( ) ) ;
501
+ let doc = hit. document ( ) . unwrap ( ) ;
502
+ assert_eq ! ( Some ( "42" ) , doc[ "my_id" ] . as_str( ) ) ;
501
503
502
504
let value = hit. into_document ( ) . unwrap ( ) ;
503
505
let expected = json ! ( {
@@ -558,7 +560,7 @@ mod integration_tests {
558
560
let ( input, events) = random_events_with_stream ( 100 , 100 ) ;
559
561
560
562
let pump = sink. send_all ( events) ;
561
- block_on ( pump) . expect ( "Sending events failed" ) ;
563
+ let _ = block_on ( pump) . expect ( "Sending events failed" ) ;
562
564
563
565
// make sure writes all all visible
564
566
block_on ( flush ( & config) ) . expect ( "Flushing writes failed" ) ;
@@ -570,24 +572,20 @@ mod integration_tests {
570
572
. unwrap ( ) ;
571
573
let test_ca = reqwest:: Certificate :: from_pem ( & test_ca) . unwrap ( ) ;
572
574
573
- let http_client = reqwest:: Client :: builder ( )
575
+ let client = reqwest:: Client :: builder ( )
574
576
. add_root_certificate ( test_ca)
575
577
. build ( )
576
578
. expect ( "Could not build HTTP client" ) ;
577
- let client = SyncClientBuilder :: new ( )
578
- . http_client ( http_client)
579
- . static_node ( config. host )
580
- . build ( )
581
- . expect ( "Building test client failed" ) ;
582
579
583
580
let response = client
584
- . search :: < Value > ( )
585
- . index ( index)
586
- . body ( json ! ( {
581
+ . get ( & format ! ( "{}/{}/_search" , config. host, index) )
582
+ . json ( & json ! ( {
587
583
"query" : { "query_string" : { "query" : "*" } }
588
584
} ) )
589
585
. send ( )
590
- . expect ( "Issuing test query failed" ) ;
586
+ . unwrap ( )
587
+ . json :: < elastic_responses:: search:: SearchResponse < Value > > ( )
588
+ . unwrap ( ) ;
591
589
592
590
assert_eq ! ( input. len( ) as u64 , response. total( ) ) ;
593
591
let input = input
0 commit comments