Skip to content

Commit 542f3ec

Browse files
committed
watcher: ES syntax update for newer versions
1 parent e93f68a commit 542f3ec

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

bin/watcher.pl

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,13 @@ ()
9898
fields => [qw< author archive >],
9999
body => {
100100
query => {
101-
filtered => {
102-
query => { match_all => {} },
103-
filter => {
104-
not => {
105-
filter => { term => { status => 'backpan' } }
106-
}
107-
}
108-
}
109-
}
110-
}
101+
bool => {
102+
must_not => [
103+
{ term => { status => 'backpan' } }
104+
],
105+
},
106+
},
107+
},
111108
);
112109

113110
my @changes;
@@ -168,14 +165,15 @@ ($info)
168165
my $scroll_release = $es_release->scroll(
169166
scroll => '1m',
170167
body => {
171-
query => { match_all => {} },
172-
filter => {
173-
and => [
174-
{ term => { author => $info->cpanid } },
175-
{ term => { archive => $info->filename } },
176-
]
168+
query => {
169+
bool => {
170+
must => [
171+
{ term => { author => $info->cpanid } },
172+
{ term => { archive => $info->filename } },
173+
],
174+
},
177175
},
178-
}
176+
},
179177
);
180178

181179
return $scroll_release->next;
@@ -193,25 +191,22 @@ ($release)
193191
fields => [qw< _parent _source >],
194192
body => {
195193
query => {
196-
filtered => {
197-
query => { match_all => {} },
198-
filter => {
199-
and => [
200-
{
201-
term => {
202-
release => $release->{_source}{name}
203-
}
204-
},
205-
{
206-
term => {
207-
author => $release->{_source}{author}
208-
}
209-
},
210-
]
211-
}
212-
}
213-
}
214-
}
194+
bool => {
195+
must => [
196+
{
197+
term => {
198+
release => $release->{_source}{name}
199+
}
200+
},
201+
{
202+
term => {
203+
author => $release->{_source}{author}
204+
}
205+
},
206+
],
207+
},
208+
},
209+
},
215210
} );
216211
return if $dry_run;
217212

0 commit comments

Comments
 (0)