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 +4 -4
- data/README.md +1 -1
- data/lib/elasticsearch/transport/client.rb +39 -31
- data/lib/elasticsearch/transport/version.rb +1 -1
- data/spec/elasticsearch/transport/client_spec.rb +285 -104
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 420122a402e799e70ce7a879b1cabe62cd4750fc356438c0f980a2b78d852fc4
|
4
|
+
data.tar.gz: 420a016f766aa19fd8c6400ae8dd78c95d76090c8de38cc1658bbd06348c3136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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 =
|
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
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
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)
|
@@ -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(
|
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:
|
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(
|
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:
|
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(
|
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:
|
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(
|
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:
|
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
|
480
|
+
context 'when the host is a String' do
|
486
481
|
|
487
|
-
|
488
|
-
'myhost'
|
489
|
-
end
|
482
|
+
context 'when there is a protocol specified' do
|
490
483
|
|
491
|
-
|
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
|
-
|
486
|
+
let(:host) do
|
487
|
+
'http://USERNAME:PASSWORD@myhost:8080'
|
488
|
+
end
|
498
489
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
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
|
-
|
507
|
-
|
508
|
-
|
495
|
+
it 'extracts the host' do
|
496
|
+
expect(hosts[0][:host]).to eq('myhost')
|
497
|
+
end
|
509
498
|
|
510
|
-
|
511
|
-
|
512
|
-
|
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
|
-
|
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
|
-
|
506
|
+
let(:host) do
|
507
|
+
'http://myhost/'
|
508
|
+
end
|
522
509
|
|
523
|
-
|
524
|
-
|
525
|
-
|
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
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
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
|
-
|
525
|
+
context 'when there is a trailing slash with a path \'http://myhost/foo/bar/\'' do
|
536
526
|
|
537
|
-
|
538
|
-
|
539
|
-
|
527
|
+
let(:host) do
|
528
|
+
'http://myhost/foo/bar/'
|
529
|
+
end
|
540
530
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
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
|
-
|
538
|
+
context 'when the protocol is http' do
|
549
539
|
|
550
|
-
|
551
|
-
'http://USERNAME:PASSWORD@myhost:8080'
|
552
|
-
end
|
540
|
+
context 'when there is no port specified \'http://myhost\'' do
|
553
541
|
|
554
|
-
|
555
|
-
|
556
|
-
|
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
|
-
|
546
|
+
it 'extracts the host' do
|
547
|
+
expect(hosts[0][:host]).to eq('myhost')
|
548
|
+
end
|
564
549
|
|
565
|
-
|
566
|
-
|
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
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
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
|
704
|
+
context 'when no protocol is specified \'myhost\'' do
|
577
705
|
|
578
706
|
let(:host) do
|
579
|
-
'
|
707
|
+
'myhost'
|
580
708
|
end
|
581
709
|
|
582
|
-
it '
|
710
|
+
it 'defaults to http' do
|
583
711
|
expect(hosts[0][:host]).to eq('myhost')
|
584
|
-
expect(hosts[0][:
|
585
|
-
|
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
|
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
|
-
|
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
|
-
|
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 '
|
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
|
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
|
-
|
785
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
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
|
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.
|
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:
|
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.
|
430
|
+
rubygems_version: 3.1.4
|
431
431
|
signing_key:
|
432
432
|
specification_version: 4
|
433
433
|
summary: Ruby client for Elasticsearch.
|