elasticsearch-transport 7.10.0 → 7.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cec988f9a2a79c9458bc3974d3d52a541cba9b230de23b96df5f74a913de6524
4
- data.tar.gz: 2eb97ff41d033724456132546b642663074dc5859fe2f8a9aa9973dbbf85342d
3
+ metadata.gz: 420122a402e799e70ce7a879b1cabe62cd4750fc356438c0f980a2b78d852fc4
4
+ data.tar.gz: 420a016f766aa19fd8c6400ae8dd78c95d76090c8de38cc1658bbd06348c3136
5
5
  SHA512:
6
- metadata.gz: df0608bf2a72da4d41ce9f7884d63f1279deccd317e1a8379846cee95d556d8f8c91af31049c6d1206b8a28087f4706f655c9a0429beda386d33b82a683dce09
7
- data.tar.gz: 8c37e0c4e02c890241981f42be1a9823d91e9c0c9d010e7193d3a46069448965752495a2e447db15a0f6318d35152c31162a997f3093958cd8e02f623e812cf9
6
+ metadata.gz: ed848e2746878f56203c6c3a9d73a0f995f65cf5854ef262d3504f98f6a889ee74e4c5e7c67bbe0d0a89b1a03c55ddd74e56c2d6efc65adbaabcd0f557653656
7
+ data.tar.gz: c7ba8b088fad4ecb5fd55870f8c50e7fb68b66ca1c157993e69cee0db4205b6371f4b69f83431196e825f22ed08affc35be5c94f5d42b4558d22feb9e0236555
data/README.md CHANGED
@@ -136,7 +136,7 @@ Please see below for an exception to this when connecting using an Elastic Cloud
136
136
 
137
137
  If you are using [Elastic Cloud](https://www.elastic.co/cloud), you can provide your cloud id to the client.
138
138
  You must supply your username and password separately, and optionally a port. If no port is supplied,
139
- port 9243 will be used.
139
+ port 443 will be used.
140
140
 
141
141
  Note: Do not enable sniffing when using Elastic Cloud. The nodes are behind a load balancer so
142
142
  Elastic Cloud will take care of everything for you.
@@ -49,9 +49,15 @@ module Elasticsearch
49
49
  DEFAULT_HOST = 'localhost:9200'.freeze
50
50
 
51
51
  # The default port to use if connecting using a Cloud ID.
52
+ # Updated from 9243 to 443 in client version 7.10.1
52
53
  #
53
54
  # @since 7.2.0
54
- DEFAULT_CLOUD_PORT = 9243
55
+ DEFAULT_CLOUD_PORT = 443
56
+
57
+ # The default port to use if not otherwise specified.
58
+ #
59
+ # @since 7.2.0
60
+ DEFAULT_PORT = 9200
55
61
 
56
62
  # Returns the transport object.
57
63
  #
@@ -243,36 +249,38 @@ module Elasticsearch
243
249
 
244
250
  def __parse_host(host)
245
251
  host_parts = case host
246
- when String
247
- if host =~ /^[a-z]+\:\/\//
248
- # Construct a new `URI::Generic` directly from the array returned by URI::split.
249
- # This avoids `URI::HTTP` and `URI::HTTPS`, which supply default ports.
250
- uri = URI::Generic.new(*URI.split(host))
251
-
252
- { :scheme => uri.scheme,
253
- :user => uri.user,
254
- :password => uri.password,
255
- :host => uri.host,
256
- :path => uri.path,
257
- :port => uri.port }
258
- else
259
- host, port = host.split(':')
260
- { :host => host,
261
- :port => port }
262
- end
263
- when URI
264
- { :scheme => host.scheme,
265
- :user => host.user,
266
- :password => host.password,
267
- :host => host.host,
268
- :path => host.path,
269
- :port => host.port }
270
- when Hash
271
- host
272
- else
273
- raise ArgumentError, "Please pass host as a String, URI or Hash -- #{host.class} given."
274
- end
275
-
252
+ when String
253
+ if host =~ /^[a-z]+\:\/\//
254
+ # Construct a new `URI::Generic` directly from the array returned by URI::split.
255
+ # This avoids `URI::HTTP` and `URI::HTTPS`, which supply default ports.
256
+ uri = URI::Generic.new(*URI.split(host))
257
+ default_port = uri.scheme == 'https' ? 443 : DEFAULT_PORT
258
+ {
259
+ scheme: uri.scheme,
260
+ user: uri.user,
261
+ password: uri.password,
262
+ host: uri.host,
263
+ path: uri.path,
264
+ port: uri.port || default_port
265
+ }
266
+ else
267
+ host, port = host.split(':')
268
+ { host: host, port: port }
269
+ end
270
+ when URI
271
+ {
272
+ scheme: host.scheme,
273
+ user: host.user,
274
+ password: host.password,
275
+ host: host.host,
276
+ path: host.path,
277
+ port: host.port
278
+ }
279
+ when Hash
280
+ host
281
+ else
282
+ raise ArgumentError, "Please pass host as a String, URI or Hash -- #{host.class} given."
283
+ end
276
284
  if @api_key
277
285
  # Remove Basic Auth if using API KEY
278
286
  host_parts.delete(:user)
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Transport
20
- VERSION = "7.10.0"
20
+ VERSION = "7.10.1"
21
21
  end
22
22
  end
@@ -344,24 +344,19 @@ describe Elasticsearch::Transport::Client do
344
344
  expect(hosts[0][:protocol]).to eq('https')
345
345
  expect(hosts[0][:user]).to eq('elastic')
346
346
  expect(hosts[0][:password]).to eq('changeme')
347
- expect(hosts[0][:port]).to eq(9243)
347
+ expect(hosts[0][:port]).to eq(443)
348
348
  end
349
349
 
350
350
  it 'creates the correct full url' do
351
351
  expect(
352
352
  client.transport.__full_url(client.transport.hosts[0])
353
- ).to eq('https://elastic:changeme@abcd.localhost:9243')
353
+ ).to eq('https://elastic:changeme@abcd.localhost:443')
354
354
  end
355
355
 
356
356
  context 'when a port is specified' do
357
357
 
358
358
  let(:client) do
359
- described_class.new(
360
- cloud_id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==',
361
- user: 'elastic',
362
- password: 'changeme',
363
- port: 9200
364
- )
359
+ described_class.new(cloud_id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', user: 'elastic', password: 'changeme', port: 9250)
365
360
  end
366
361
 
367
362
  it 'sets the specified port along with the cloud credentials' do
@@ -369,11 +364,11 @@ describe Elasticsearch::Transport::Client do
369
364
  expect(hosts[0][:protocol]).to eq('https')
370
365
  expect(hosts[0][:user]).to eq('elastic')
371
366
  expect(hosts[0][:password]).to eq('changeme')
372
- expect(hosts[0][:port]).to eq(9200)
367
+ expect(hosts[0][:port]).to eq(9250)
373
368
  end
374
369
 
375
370
  it 'creates the correct full url' do
376
- expect(client.transport.__full_url(client.transport.hosts[0])).to eq('https://elastic:changeme@abcd.localhost:9200')
371
+ expect(client.transport.__full_url(client.transport.hosts[0])).to eq('https://elastic:changeme@abcd.localhost:9250')
377
372
  end
378
373
  end
379
374
 
@@ -396,13 +391,13 @@ describe Elasticsearch::Transport::Client do
396
391
  expect(hosts[0][:protocol]).to eq('https')
397
392
  expect(hosts[0][:user]).to eq('elasticfantastic')
398
393
  expect(hosts[0][:password]).to eq('tobechanged')
399
- expect(hosts[0][:port]).to eq(9243)
394
+ expect(hosts[0][:port]).to eq(443)
400
395
  end
401
396
 
402
397
  it 'creates the correct full url' do
403
398
  expect(
404
399
  client.transport.__full_url(client.transport.hosts[0])
405
- ).to eq('https://elasticfantastic:tobechanged@abcd.localhost:9243')
400
+ ).to eq('https://elasticfantastic:tobechanged@abcd.localhost:443')
406
401
  end
407
402
  end
408
403
 
@@ -424,13 +419,13 @@ describe Elasticsearch::Transport::Client do
424
419
  expect(hosts[0][:protocol]).to eq('https')
425
420
  expect(hosts[0][:user]).to eq('elasticfantastic')
426
421
  expect(hosts[0][:password]).to eq('changeme')
427
- expect(hosts[0][:port]).to eq(9243)
422
+ expect(hosts[0][:port]).to eq(443)
428
423
  end
429
424
 
430
425
  it 'creates the correct full url' do
431
426
  expect(
432
427
  client.transport.__full_url(client.transport.hosts[0])
433
- ).to eq('https://elasticfantastic:changeme@abcd.localhost:9243')
428
+ ).to eq('https://elasticfantastic:changeme@abcd.localhost:443')
434
429
  end
435
430
  end
436
431
 
@@ -482,112 +477,248 @@ describe Elasticsearch::Transport::Client do
482
477
 
483
478
  shared_examples_for 'a client that extracts hosts' do
484
479
 
485
- context 'when the hosts are a String' do
480
+ context 'when the host is a String' do
486
481
 
487
- let(:host) do
488
- 'myhost'
489
- end
482
+ context 'when there is a protocol specified' do
490
483
 
491
- it 'extracts the host' do
492
- expect(hosts[0][:host]).to eq('myhost')
493
- expect(hosts[0][:protocol]).to eq('http')
494
- expect(hosts[0][:port]).to be(9200)
495
- end
484
+ context 'when credentials are specified \'http://USERNAME:PASSWORD@myhost:8080\'' do
496
485
 
497
- context 'when IPv6 format is used' do
486
+ let(:host) do
487
+ 'http://USERNAME:PASSWORD@myhost:8080'
488
+ end
498
489
 
499
- around do |example|
500
- original_setting = Faraday.ignore_env_proxy
501
- Faraday.ignore_env_proxy = true
502
- example.run
503
- Faraday.ignore_env_proxy = original_setting
504
- end
490
+ it 'extracts the credentials' do
491
+ expect(hosts[0][:user]).to eq('USERNAME')
492
+ expect(hosts[0][:password]).to eq('PASSWORD')
493
+ end
505
494
 
506
- let(:host) do
507
- 'https://[2090:db8:85a3:9811::1f]:8080'
508
- end
495
+ it 'extracts the host' do
496
+ expect(hosts[0][:host]).to eq('myhost')
497
+ end
509
498
 
510
- it 'extracts the host' do
511
- expect(hosts[0][:host]).to eq('[2090:db8:85a3:9811::1f]')
512
- expect(hosts[0][:scheme]).to eq('https')
513
- expect(hosts[0][:port]).to be(8080)
499
+ it 'extracts the port' do
500
+ expect(hosts[0][:port]).to be(8080)
501
+ end
514
502
  end
515
503
 
516
- it 'creates the correct full url' do
517
- expect(client.transport.__full_url(client.transport.hosts[0])).to eq('https://[2090:db8:85a3:9811::1f]:8080')
518
- end
519
- end
504
+ context 'when there is a trailing slash \'http://myhost/\'' do
520
505
 
521
- context 'when a path is specified' do
506
+ let(:host) do
507
+ 'http://myhost/'
508
+ end
522
509
 
523
- let(:host) do
524
- 'https://myhost:8080/api'
525
- end
510
+ it 'extracts the host' do
511
+ expect(hosts[0][:host]).to eq('myhost')
512
+ expect(hosts[0][:scheme]).to eq('http')
513
+ expect(hosts[0][:path]).to eq('')
514
+ end
526
515
 
527
- it 'extracts the host' do
528
- expect(hosts[0][:host]).to eq('myhost')
529
- expect(hosts[0][:scheme]).to eq('https')
530
- expect(hosts[0][:path]).to eq('/api')
531
- expect(hosts[0][:port]).to be(8080)
516
+ it 'extracts the scheme' do
517
+ expect(hosts[0][:scheme]).to eq('http')
518
+ end
519
+
520
+ it 'extracts the path' do
521
+ expect(hosts[0][:path]).to eq('')
522
+ end
532
523
  end
533
- end
534
524
 
535
- context 'when a scheme is specified' do
525
+ context 'when there is a trailing slash with a path \'http://myhost/foo/bar/\'' do
536
526
 
537
- let(:host) do
538
- 'https://myhost:8080'
539
- end
527
+ let(:host) do
528
+ 'http://myhost/foo/bar/'
529
+ end
540
530
 
541
- it 'extracts the host' do
542
- expect(hosts[0][:host]).to eq('myhost')
543
- expect(hosts[0][:scheme]).to eq('https')
544
- expect(hosts[0][:port]).to be(8080)
531
+ it 'extracts the host' do
532
+ expect(hosts[0][:host]).to eq('myhost')
533
+ expect(hosts[0][:scheme]).to eq('http')
534
+ expect(hosts[0][:path]).to eq('/foo/bar')
535
+ end
545
536
  end
546
- end
547
537
 
548
- context 'when credentials are specified' do
538
+ context 'when the protocol is http' do
549
539
 
550
- let(:host) do
551
- 'http://USERNAME:PASSWORD@myhost:8080'
552
- end
540
+ context 'when there is no port specified \'http://myhost\'' do
553
541
 
554
- it 'extracts the host' do
555
- expect(hosts[0][:host]).to eq('myhost')
556
- expect(hosts[0][:scheme]).to eq('http')
557
- expect(hosts[0][:user]).to eq('USERNAME')
558
- expect(hosts[0][:password]).to eq('PASSWORD')
559
- expect(hosts[0][:port]).to be(8080)
560
- end
561
- end
542
+ let(:host) do
543
+ 'http://myhost'
544
+ end
562
545
 
563
- context 'when there is a trailing slash' do
546
+ it 'extracts the host' do
547
+ expect(hosts[0][:host]).to eq('myhost')
548
+ end
564
549
 
565
- let(:host) do
566
- 'http://myhost/'
550
+ it 'extracts the protocol' do
551
+ expect(hosts[0][:protocol]).to eq('http')
552
+ end
553
+
554
+ it 'defaults to port 9200' do
555
+ expect(hosts[0][:port]).to be(9200)
556
+ end
557
+ end
558
+
559
+ context 'when there is a port specified \'http://myhost:7101\'' do
560
+
561
+ let(:host) do
562
+ 'http://myhost:7101'
563
+ end
564
+
565
+ it 'extracts the host' do
566
+ expect(hosts[0][:host]).to eq('myhost')
567
+ end
568
+
569
+ it 'extracts the protocol' do
570
+ expect(hosts[0][:protocol]).to eq('http')
571
+ end
572
+
573
+ it 'extracts the port' do
574
+ expect(hosts[0][:port]).to be(7101)
575
+ end
576
+
577
+ context 'when there is a path specified \'http://myhost:7101/api\'' do
578
+
579
+ let(:host) do
580
+ 'http://myhost:7101/api'
581
+ end
582
+
583
+ it 'sets the path' do
584
+ expect(hosts[0][:host]).to eq('myhost')
585
+ expect(hosts[0][:protocol]).to eq('http')
586
+ expect(hosts[0][:path]).to eq('/api')
587
+ expect(hosts[0][:port]).to be(7101)
588
+ end
589
+
590
+ it 'extracts the host' do
591
+ expect(hosts[0][:host]).to eq('myhost')
592
+ end
593
+
594
+ it 'extracts the protocol' do
595
+ expect(hosts[0][:protocol]).to eq('http')
596
+ end
597
+
598
+ it 'extracts the port' do
599
+ expect(hosts[0][:port]).to be(7101)
600
+ end
601
+
602
+ it 'extracts the path' do
603
+ expect(hosts[0][:path]).to eq('/api')
604
+ end
605
+ end
606
+ end
567
607
  end
568
608
 
569
- it 'extracts the host' do
570
- expect(hosts[0][:host]).to eq('myhost')
571
- expect(hosts[0][:scheme]).to eq('http')
572
- expect(hosts[0][:path]).to eq('')
609
+ context 'when the protocol is https' do
610
+
611
+ context 'when there is no port specified \'https://myhost\'' do
612
+
613
+ let(:host) do
614
+ 'https://myhost'
615
+ end
616
+
617
+ it 'extracts the host' do
618
+ expect(hosts[0][:host]).to eq('myhost')
619
+ end
620
+
621
+ it 'extracts the protocol' do
622
+ expect(hosts[0][:protocol]).to eq('https')
623
+ end
624
+
625
+ it 'defaults to port 443' do
626
+ expect(hosts[0][:port]).to be(443)
627
+ end
628
+ end
629
+
630
+ context 'when there is a port specified \'https://myhost:7101\'' do
631
+
632
+ let(:host) do
633
+ 'https://myhost:7101'
634
+ end
635
+
636
+ it 'extracts the host' do
637
+ expect(hosts[0][:host]).to eq('myhost')
638
+ end
639
+
640
+ it 'extracts the protocol' do
641
+ expect(hosts[0][:protocol]).to eq('https')
642
+ end
643
+
644
+ it 'extracts the port' do
645
+ expect(hosts[0][:port]).to be(7101)
646
+ end
647
+
648
+ context 'when there is a path specified \'https://myhost:7101/api\'' do
649
+
650
+ let(:host) do
651
+ 'https://myhost:7101/api'
652
+ end
653
+
654
+ it 'extracts the host' do
655
+ expect(hosts[0][:host]).to eq('myhost')
656
+ end
657
+
658
+ it 'extracts the protocol' do
659
+ expect(hosts[0][:protocol]).to eq('https')
660
+ end
661
+
662
+ it 'extracts the port' do
663
+ expect(hosts[0][:port]).to be(7101)
664
+ end
665
+
666
+ it 'extracts the path' do
667
+ expect(hosts[0][:path]).to eq('/api')
668
+ end
669
+ end
670
+ end
671
+
672
+ context 'when IPv6 format is used' do
673
+
674
+ around do |example|
675
+ original_setting = Faraday.ignore_env_proxy
676
+ Faraday.ignore_env_proxy = true
677
+ example.run
678
+ Faraday.ignore_env_proxy = original_setting
679
+ end
680
+
681
+ let(:host) do
682
+ 'https://[2090:db8:85a3:9811::1f]:8080'
683
+ end
684
+
685
+ it 'extracts the host' do
686
+ expect(hosts[0][:host]).to eq('[2090:db8:85a3:9811::1f]')
687
+ end
688
+
689
+ it 'extracts the protocol' do
690
+ expect(hosts[0][:protocol]).to eq('https')
691
+ end
692
+
693
+ it 'extracts the port' do
694
+ expect(hosts[0][:port]).to be(8080)
695
+ end
696
+
697
+ it 'creates the correct full url' do
698
+ expect(client.transport.__full_url(client.transport.hosts[0])).to eq('https://[2090:db8:85a3:9811::1f]:8080')
699
+ end
700
+ end
573
701
  end
574
702
  end
575
703
 
576
- context 'when there is a trailing slash with a path' do
704
+ context 'when no protocol is specified \'myhost\'' do
577
705
 
578
706
  let(:host) do
579
- 'http://myhost/foo/bar/'
707
+ 'myhost'
580
708
  end
581
709
 
582
- it 'extracts the host' do
710
+ it 'defaults to http' do
583
711
  expect(hosts[0][:host]).to eq('myhost')
584
- expect(hosts[0][:scheme]).to eq('http')
585
- expect(hosts[0][:path]).to eq('/foo/bar')
712
+ expect(hosts[0][:protocol]).to eq('http')
713
+ end
714
+
715
+ it 'uses port 9200' do
716
+ expect(hosts[0][:port]).to be(9200)
586
717
  end
587
718
  end
588
719
  end
589
720
 
590
- context 'when the hosts are a Hash' do
721
+ context 'when the host is a Hash' do
591
722
 
592
723
  let(:host) do
593
724
  { :host => 'myhost', :scheme => 'https' }
@@ -595,7 +726,13 @@ describe Elasticsearch::Transport::Client do
595
726
 
596
727
  it 'extracts the host' do
597
728
  expect(hosts[0][:host]).to eq('myhost')
598
- expect(hosts[0][:scheme]).to eq('https')
729
+ end
730
+
731
+ it 'extracts the protocol' do
732
+ expect(hosts[0][:protocol]).to eq('https')
733
+ end
734
+
735
+ it 'extracts the port' do
599
736
  expect(hosts[0][:port]).to be(9200)
600
737
  end
601
738
 
@@ -654,7 +791,13 @@ describe Elasticsearch::Transport::Client do
654
791
 
655
792
  it 'extracts the host' do
656
793
  expect(hosts[0][:host]).to eq('myhost')
794
+ end
795
+
796
+ it 'extracts the protocol' do
657
797
  expect(hosts[0][:scheme]).to eq('https')
798
+ end
799
+
800
+ it 'converts the port to an integer' do
658
801
  expect(hosts[0][:port]).to be(443)
659
802
  end
660
803
  end
@@ -667,7 +810,13 @@ describe Elasticsearch::Transport::Client do
667
810
 
668
811
  it 'extracts the host' do
669
812
  expect(hosts[0][:host]).to eq('myhost')
813
+ end
814
+
815
+ it 'extracts the protocol' do
670
816
  expect(hosts[0][:scheme]).to eq('https')
817
+ end
818
+
819
+ it 'extracts port as an integer' do
671
820
  expect(hosts[0][:port]).to be(443)
672
821
  end
673
822
  end
@@ -681,7 +830,13 @@ describe Elasticsearch::Transport::Client do
681
830
 
682
831
  it 'extracts the host' do
683
832
  expect(hosts[0][:host]).to eq('myhost')
833
+ end
834
+
835
+ it 'extracts the protocol' do
684
836
  expect(hosts[0][:scheme]).to eq('https')
837
+ end
838
+
839
+ it 'converts the port to an integer' do
685
840
  expect(hosts[0][:port]).to be(9200)
686
841
  end
687
842
 
@@ -693,7 +848,13 @@ describe Elasticsearch::Transport::Client do
693
848
 
694
849
  it 'extracts the host' do
695
850
  expect(hosts[0][:host]).to eq('myhost')
851
+ end
852
+
853
+ it 'extracts the protocol' do
696
854
  expect(hosts[0][:scheme]).to eq('https')
855
+ end
856
+
857
+ it 'converts the port to an integer' do
697
858
  expect(hosts[0][:port]).to be(443)
698
859
  end
699
860
  end
@@ -706,7 +867,13 @@ describe Elasticsearch::Transport::Client do
706
867
 
707
868
  it 'extracts the host' do
708
869
  expect(hosts[0][:host]).to eq('myhost')
870
+ end
871
+
872
+ it 'extracts the protocol' do
709
873
  expect(hosts[0][:scheme]).to eq('https')
874
+ end
875
+
876
+ it 'extracts port as an integer' do
710
877
  expect(hosts[0][:port]).to be(443)
711
878
  end
712
879
  end
@@ -722,7 +889,13 @@ describe Elasticsearch::Transport::Client do
722
889
 
723
890
  it 'extracts the host' do
724
891
  expect(hosts[0][:host]).to eq('myhost')
892
+ end
893
+
894
+ it 'extracts the protocol' do
725
895
  expect(hosts[0][:protocol]).to eq('http')
896
+ end
897
+
898
+ it 'defaults to port 9200' do
726
899
  expect(hosts[0][:port]).to be(9200)
727
900
  end
728
901
  end
@@ -735,20 +908,13 @@ describe Elasticsearch::Transport::Client do
735
908
 
736
909
  it 'extracts the host' do
737
910
  expect(hosts[0][:host]).to eq('myhost')
738
- expect(hosts[0][:protocol]).to eq('http')
739
- expect(hosts[0][:port]).to be(9200)
740
911
  end
741
- end
742
912
 
743
- context 'when there is one host with a protocol and no port' do
744
-
745
- let(:host) do
746
- ['http://myhost']
913
+ it 'extracts the protocol' do
914
+ expect(hosts[0][:scheme]).to eq('http')
747
915
  end
748
916
 
749
- it 'extracts the host' do
750
- expect(hosts[0][:host]).to eq('myhost')
751
- expect(hosts[0][:protocol]).to eq('http')
917
+ it 'defaults to port 9200' do
752
918
  expect(hosts[0][:port]).to be(9200)
753
919
  end
754
920
  end
@@ -773,7 +939,7 @@ describe Elasticsearch::Transport::Client do
773
939
  end
774
940
  end
775
941
 
776
- context 'when there is one host with a scheme, protocol and no port' do
942
+ context 'when there is one host with a protocol and no port' do
777
943
 
778
944
  let(:host) do
779
945
  ['https://myhost']
@@ -781,12 +947,18 @@ describe Elasticsearch::Transport::Client do
781
947
 
782
948
  it 'extracts the host' do
783
949
  expect(hosts[0][:host]).to eq('myhost')
784
- expect(hosts[0][:protocol]).to eq('https')
785
- expect(hosts[0][:port]).to be(9200)
950
+ end
951
+
952
+ it 'extracts the protocol' do
953
+ expect(hosts[0][:scheme]).to eq('https')
954
+ end
955
+
956
+ it 'defaults to port 443' do
957
+ expect(hosts[0][:port]).to be(443)
786
958
  end
787
959
  end
788
960
 
789
- context 'when there is one host with a scheme, protocol, path, and no port' do
961
+ context 'when there is one host with a protocol, path, and no port' do
790
962
 
791
963
  let(:host) do
792
964
  ['http://myhost/foo/bar']
@@ -794,9 +966,18 @@ describe Elasticsearch::Transport::Client do
794
966
 
795
967
  it 'extracts the host' do
796
968
  expect(hosts[0][:host]).to eq('myhost')
797
- expect(hosts[0][:protocol]).to eq('http')
969
+ end
970
+
971
+ it 'extracts the protocol' do
972
+ expect(hosts[0][:scheme]).to eq('http')
973
+ end
974
+
975
+ it 'defaults to port 9200' do
798
976
  expect(hosts[0][:port]).to be(9200)
799
- expect(hosts[0][:path]).to eq("/foo/bar")
977
+ end
978
+
979
+ it 'extracts the path' do
980
+ expect(hosts[0][:path]).to eq('/foo/bar')
800
981
  end
801
982
  end
802
983
 
@@ -806,7 +987,7 @@ describe Elasticsearch::Transport::Client do
806
987
  ['host1', 'host2']
807
988
  end
808
989
 
809
- it 'extracts the host' do
990
+ it 'extracts the hosts' do
810
991
  expect(hosts[0][:host]).to eq('host1')
811
992
  expect(hosts[0][:protocol]).to eq('http')
812
993
  expect(hosts[0][:port]).to be(9200)
@@ -822,7 +1003,7 @@ describe Elasticsearch::Transport::Client do
822
1003
  ['host1:1000', 'host2:2000']
823
1004
  end
824
1005
 
825
- it 'extracts the host' do
1006
+ it 'extracts the hosts' do
826
1007
  expect(hosts[0][:host]).to eq('host1')
827
1008
  expect(hosts[0][:protocol]).to eq('http')
828
1009
  expect(hosts[0][:port]).to be(1000)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.10.0
4
+ version: 7.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-16 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -355,7 +355,7 @@ dependencies:
355
355
  description: 'Ruby client for Elasticsearch. See the `elasticsearch` gem for full
356
356
  integration.
357
357
 
358
- '
358
+ '
359
359
  email:
360
360
  - karel.minarik@elasticsearch.org
361
361
  executables: []
@@ -427,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
427
  - !ruby/object:Gem::Version
428
428
  version: '0'
429
429
  requirements: []
430
- rubygems_version: 3.1.2
430
+ rubygems_version: 3.1.4
431
431
  signing_key:
432
432
  specification_version: 4
433
433
  summary: Ruby client for Elasticsearch.