Skip to content

Commit 1a6102f

Browse files
committed
s/v1/cpan/
1 parent 9be29fb commit 1a6102f

29 files changed

+38
-36
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ v1:
8282
use Search::Elasticsearch;
8383
my $es = Search::Elasticsearch->new(
8484
cxn_pool => 'Static::NoPing',
85-
nodes => 'https://fastapi.metacpan.org',
85+
nodes => 'https://fastapi.metacpan.org/v1',
8686
send_get_body_as => 'POST',
8787
trace_to => 'Stdout',
8888
);
8989
```
9090

91-
* The URL of the v1 API is https://fastapi.metacpan.org Note that not only is the host name new, but we've also switched to https.
91+
* The node URL of the v1 API is https://fastapi.metacpan.org/v1 Note that not
92+
only is the host name new, but we've also switched to https and also added
93+
the version to the path.
9294

9395
* You'll need to set `send_get_body_as => 'POST'`. This is because v1 does not accept `GET` with a body.
9496

@@ -112,7 +114,7 @@ my $faves = $es->search(
112114

113115
```perl
114116
my $faves = es()->search(
115-
index => 'v1',
117+
index => 'cpan',
116118
type => 'favorite',
117119
body => {
118120
aggs => {
@@ -124,7 +126,7 @@ my $faves = es()->search(
124126
);
125127
```
126128

127-
* The index is now `v1`
129+
* The index name is now `cpan`
128130
* `match_all` is the default query type, so it's not required to specify it
129131
* `facets` have been replaced by `aggs`
130132
* The data structure returned for `facets` does not mirror the `aggs` return values, so you'll need to rework your logic when checking the return values.
@@ -138,4 +140,4 @@ v1: `https://fastapi.metacpan.org/v1/author/MSTROUT`
138140

139141
* Note the new host name
140142
* Note that we now use HTTPS
141-
* Note that the path begins with v0 rather than v1
143+
* Note that the path begins with v1 rather than v0

lib/MetaCPAN/Util.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use Sub::Exporter -setup => { exports => ['es'] };
99
sub es {
1010
return Search::Elasticsearch->new(
1111
cxn_pool => 'Static::NoPing',
12-
nodes => 'https://fastapi.metacpan.org',
12+
nodes => 'https://fastapi.metacpan.org/v1',
1313
send_get_body_as => 'POST',
1414
trace_to => 'Stdout',
1515
);

scripts/author/1-fetch-single-author-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
);
1414

1515
my $author = $es->get(
16-
index => 'v1',
16+
index => 'cpan',
1717
type => 'author',
1818
id => 'MSTROUT',
1919
);

scripts/author/1b-scroll-all-authors-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
my $scroller = es()->scroll_helper(
1010
search_type => 'scan',
1111
scroll => '5m',
12-
index => 'v1',
12+
index => 'cpan',
1313
type => 'author',
1414
size => 100,
1515
body => {

scripts/author/1c-scroll-all-authors-with-twitter-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
my $scroller = es()->scroll_helper(
1010
search_type => 'scan',
1111
scroll => '5m',
12-
index => 'v1',
12+
index => 'cpan',
1313
type => 'author',
1414
size => 100,
1515
body => {

scripts/author/2-twitter-or-github-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
my $scroller = es()->scroll_helper(
1010
search_type => 'scan',
1111
scroll => '5m',
12-
index => 'v1',
12+
index => 'cpan',
1313
type => 'author',
1414
size => 100,
1515
body => {

scripts/distribution/1-bugs-for-dist-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $dist = es()->get(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'distribution',
1212
id => 'Moose',
1313
);

scripts/favorite/1-last-50-favorited-dists-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $faves = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'favorite',
1212
body => {
1313
query => { match_all => {} },

scripts/favorite/1a-last-100-favorited-dists-by-user-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
die "usage: ./bin/carton $0 \$user_id" if !$id;
1212

1313
my $faves = es()->search(
14-
index => 'v1',
14+
index => 'cpan',
1515
type => 'favorite',
1616
body => {
1717
query => {

scripts/favorite/2-favorites-previous-month-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
my $then = $now->clone->subtract( months => 1 );
1212

1313
my $faves = es()->search(
14-
index => 'v1',
14+
index => 'cpan',
1515
type => 'favorite',
1616
body => {
1717
query => {

scripts/favorite/3-leaderboard-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $faves = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'favorite',
1212
body => {
1313
aggs => {

scripts/favorite/4-leaderboard-previous-month-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
my $then = $now->clone->subtract( months => 1 );
1212

1313
my $faves = es()->search(
14-
index => 'v1',
14+
index => 'cpan',
1515
type => 'favorite',
1616
body => {
1717
query => {

scripts/favorite/5-plus-plus-your-favorites-es.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
unless @modules;
1616

1717
my $module = es()->search(
18-
index => 'v1',
18+
index => 'cpan',
1919
type => 'file',
2020
fields => 'release',
2121
size => scalar @modules,
@@ -42,7 +42,7 @@
4242
= map { $_->{fields}->{release} } @{ $module->{hits}->{hits} };
4343

4444
my $release = es()->search(
45-
index => 'v1',
45+
index => 'cpan',
4646
type => 'release',
4747
size => scalar @release_names,
4848
body => {

scripts/favorite/6-list-plussers-by-module.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
my $module = MetaCPAN::Client->new->module($module_name);
1717

1818
my $plussers = es()->search(
19-
index => 'v1',
19+
index => 'cpan',
2020
type => 'favorite',
2121
size => 1000,
2222
body => {
@@ -35,7 +35,7 @@
3535
my $total = @ids;
3636

3737
my $authors = es()->search(
38-
index => 'v1',
38+
index => 'cpan',
3939
type => 'author',
4040
size => scalar @ids,
4141
body => {

scripts/file/1-get-files-in-dist-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use MetaCPAN::Util qw( es );
99

1010
my $files = es()->search(
11-
index => 'v1',
11+
index => 'cpan',
1212
type => 'file',
1313
size => 300,
1414
body => {

scripts/file/2-get-dists-with-cpanfile.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use MetaCPAN::Util qw( es );
99

1010
my $files = es()->search(
11-
index => 'v1',
11+
index => 'cpan',
1212
type => 'file',
1313
size => 10,
1414
body => {

scripts/file/3-find-files-in-top-level-by-name.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use MetaCPAN::Util qw( es );
99

1010
my $files = es()->search(
11-
index => 'v1',
11+
index => 'cpan',
1212
type => 'file',
1313
size => 10,
1414
body => {

scripts/file/4-main-search.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414

1515
my $result = es()->search(
16-
index => 'v1',
16+
index => 'cpan',
1717
type => 'file',
1818
body => {
1919
query => {

scripts/module/1-fetch-single-module-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $module = es()->get(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'module',
1212
id => 'HTML::Restrict',
1313
);

scripts/release/1-pkg2url-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
);
1414

1515
my $release = $es->search(
16-
index => 'v1',
16+
index => 'cpan',
1717
type => 'release',
1818
body => {
1919
filter => { term => { 'archive' => 'Acme-Hoge-0.03.tar.gz' } },

scripts/release/1a-module2url-es.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
);
1414

1515
my $module = $es->search(
16-
index => 'v1',
16+
index => 'cpan',
1717
type => 'file',
1818
body => {
1919
query => { match_all => {} },
@@ -30,7 +30,7 @@
3030
my $release_name = $module->{hits}{hits}[0]{_source}{release};
3131

3232
my $release = $es->search(
33-
index => 'v1',
33+
index => 'cpan',
3434
type => 'release',
3535
body => {
3636
filter => { term => { 'name' => $release_name } },

scripts/release/2-author-upload-leaderboard-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $uploads = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'release',
1212
body => {
1313
query => { match_all => {} },

scripts/release/3-author-uploads-one-author-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $uploads = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'release',
1212
body => {
1313
query => {

scripts/release/4-latest-release-versions-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $latest = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'release',
1212
fields => [ 'distribution', 'version' ],
1313
size => 3,

scripts/release/4a-latest-release-versions-bool-filter-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $latest = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'release',
1212
fields => [ 'distribution', 'version' ],
1313
size => 3,

scripts/release/5-latest-releases-by-author-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
die "usage: $0 PAUSEID" if !$author;
1111

1212
my $latest = es()->search(
13-
index => 'v1',
13+
index => 'cpan',
1414
type => 'release',
1515
fields => [ 'distribution', 'provides', 'version' ],
1616
size => 500,

scripts/release/6-latest-releases-with-git-repo-es.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
fields => [ 'author', 'date', 'distribution', 'name', 'resources' ],
2525
search_type => 'scan',
2626
scroll => '5m',
27-
index => 'v1',
27+
index => 'cpan',
2828
type => 'release',
2929
size => 500,
3030
);

scripts/release/7-all-releases.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
my $scroller = es()->scroll_helper(
1111
search_type => 'scan',
1212
scroll => '5m',
13-
index => 'v1',
13+
index => 'cpan',
1414
type => 'release',
1515
size => 1_000,
1616
body => { fields => ['download_url'] },

scripts/release/all-releases-by-author.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use MetaCPAN::Util qw( es );
88

99
my $uploads = es()->search(
10-
index => 'v1',
10+
index => 'cpan',
1111
type => 'release',
1212
body => {
1313
query => {

0 commit comments

Comments
 (0)