line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Licensed to Elasticsearch B.V under one or more agreements. |
2
|
|
|
|
|
|
|
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License. |
3
|
|
|
|
|
|
|
# See the LICENSE file in the project root for more information |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Search::Elasticsearch::Client::7_0::Direct; |
6
|
|
|
|
|
|
|
$Search::Elasticsearch::Client::7_0::Direct::VERSION = '7.717'; |
7
|
55
|
|
|
55
|
|
30194
|
use Moo; |
|
55
|
|
|
|
|
104
|
|
|
55
|
|
|
|
|
271
|
|
8
|
|
|
|
|
|
|
with 'Search::Elasticsearch::Client::7_0::Role::API'; |
9
|
|
|
|
|
|
|
with 'Search::Elasticsearch::Role::Client::Direct'; |
10
|
|
|
|
|
|
|
|
11
|
55
|
|
|
55
|
|
15508
|
use Search::Elasticsearch::Util qw(parse_params is_compat); |
|
55
|
|
|
|
|
112
|
|
|
55
|
|
|
|
|
370
|
|
12
|
55
|
|
|
55
|
|
16459
|
use namespace::clean; |
|
55
|
|
|
|
|
102
|
|
|
55
|
|
|
|
|
298
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
|
|
sub _namespace {__PACKAGE__} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'async_search' => ( is => 'lazy', init_arg => undef ); |
17
|
|
|
|
|
|
|
has 'autoscaling' => ( is => 'lazy', init_arg => undef ); |
18
|
|
|
|
|
|
|
has 'cat' => ( is => 'lazy', init_arg => undef ); |
19
|
|
|
|
|
|
|
has 'ccr' => ( is => 'lazy', init_arg => undef ); |
20
|
|
|
|
|
|
|
has 'cluster' => ( is => 'lazy', init_arg => undef ); |
21
|
|
|
|
|
|
|
has 'dangling_indices' => ( is => 'lazy', init_arg => undef ); |
22
|
|
|
|
|
|
|
has 'data_frame_transform_deprecated' => ( is => 'lazy', init_arg => undef ); |
23
|
|
|
|
|
|
|
has 'enrich' => ( is => 'lazy', init_arg => undef ); |
24
|
|
|
|
|
|
|
has 'eql' => ( is => 'lazy', init_arg => undef ); |
25
|
|
|
|
|
|
|
has 'features' => ( is => 'lazy', init_arg => undef ); |
26
|
|
|
|
|
|
|
has 'fleet' => ( is => 'lazy', init_arg => undef ); |
27
|
|
|
|
|
|
|
has 'graph' => ( is => 'lazy', init_arg => undef ); |
28
|
|
|
|
|
|
|
has 'ilm' => ( is => 'lazy', init_arg => undef ); |
29
|
|
|
|
|
|
|
has 'indices' => ( is => 'lazy', init_arg => undef ); |
30
|
|
|
|
|
|
|
has 'ingest' => ( is => 'lazy', init_arg => undef ); |
31
|
|
|
|
|
|
|
has 'license' => ( is => 'lazy', init_arg => undef ); |
32
|
|
|
|
|
|
|
has 'logstash' => ( is => 'lazy', init_arg => undef ); |
33
|
|
|
|
|
|
|
has 'migration' => ( is => 'lazy', init_arg => undef ); |
34
|
|
|
|
|
|
|
has 'ml' => ( is => 'lazy', init_arg => undef ); |
35
|
|
|
|
|
|
|
has 'monitoring' => ( is => 'lazy', init_arg => undef ); |
36
|
|
|
|
|
|
|
has 'nodes' => ( is => 'lazy', init_arg => undef ); |
37
|
|
|
|
|
|
|
has 'rollup' => ( is => 'lazy', init_arg => undef ); |
38
|
|
|
|
|
|
|
has 'searchable_snapshots' => ( is => 'lazy', init_arg => undef ); |
39
|
|
|
|
|
|
|
has 'security' => ( is => 'lazy', init_arg => undef ); |
40
|
|
|
|
|
|
|
has 'shutdown' => ( is => 'lazy', init_arg => undef ); |
41
|
|
|
|
|
|
|
has 'snapshot' => ( is => 'lazy', init_arg => undef ); |
42
|
|
|
|
|
|
|
has 'slm' => ( is => 'lazy', init_arg => undef ); |
43
|
|
|
|
|
|
|
has 'sql' => ( is => 'lazy', init_arg => undef ); |
44
|
|
|
|
|
|
|
has 'ssl' => ( is => 'lazy', init_arg => undef ); |
45
|
|
|
|
|
|
|
has 'tasks' => ( is => 'lazy', init_arg => undef ); |
46
|
|
|
|
|
|
|
has 'text_structure' => ( is => 'lazy', init_arg => undef ); |
47
|
|
|
|
|
|
|
has 'transform' => ( is => 'lazy', init_arg => undef ); |
48
|
|
|
|
|
|
|
has 'watcher' => ( is => 'lazy', init_arg => undef ); |
49
|
|
|
|
|
|
|
has 'xpack' => ( is => 'lazy', init_arg => undef ); |
50
|
|
|
|
|
|
|
has 'bulk_helper_class' => ( is => 'rw' ); |
51
|
|
|
|
|
|
|
has 'scroll_helper_class' => ( is => 'rw' ); |
52
|
|
|
|
|
|
|
has '_bulk_class' => ( is => 'lazy' ); |
53
|
|
|
|
|
|
|
has '_scroll_class' => ( is => 'lazy' ); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#=================================== |
56
|
|
|
|
|
|
|
sub _build__bulk_class { |
57
|
|
|
|
|
|
|
#=================================== |
58
|
0
|
|
|
0
|
|
|
my $self = shift; |
59
|
0
|
|
0
|
|
|
|
my $bulk_class = $self->bulk_helper_class |
60
|
|
|
|
|
|
|
|| 'Client::' . $self->api_version . '::Bulk'; |
61
|
0
|
|
|
|
|
|
$self->_build_helper( 'bulk', $bulk_class ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#=================================== |
65
|
|
|
|
|
|
|
sub _build__scroll_class { |
66
|
|
|
|
|
|
|
#=================================== |
67
|
0
|
|
|
0
|
|
|
my $self = shift; |
68
|
0
|
|
0
|
|
|
|
my $scroll_class = $self->scroll_helper_class |
69
|
|
|
|
|
|
|
|| 'Client::' . $self->api_version . '::Scroll'; |
70
|
0
|
|
|
|
|
|
$self->_build_helper( 'scroll', $scroll_class ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#=================================== |
74
|
|
|
|
|
|
|
sub bulk_helper { |
75
|
|
|
|
|
|
|
#=================================== |
76
|
0
|
|
|
0
|
1
|
|
my ( $self, $params ) = parse_params(@_); |
77
|
0
|
|
0
|
|
|
|
$params->{es} ||= $self; |
78
|
0
|
|
|
|
|
|
$self->_bulk_class->new($params); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#=================================== |
82
|
|
|
|
|
|
|
sub scroll_helper { |
83
|
|
|
|
|
|
|
#=================================== |
84
|
0
|
|
|
0
|
1
|
|
my ( $self, $params ) = parse_params(@_); |
85
|
0
|
|
0
|
|
|
|
$params->{es} ||= $self; |
86
|
0
|
|
|
|
|
|
$self->_scroll_class->new($params); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#=================================== |
90
|
0
|
|
|
0
|
|
|
sub _build_autoscaling { shift->_build_namespace('Autoscaling') } |
91
|
0
|
|
|
0
|
|
|
sub _build_async_search { shift->_build_namespace('AsyncSearch') } |
92
|
0
|
|
|
0
|
|
|
sub _build_cat { shift->_build_namespace('Cat') } |
93
|
0
|
|
|
0
|
|
|
sub _build_ccr { shift->_build_namespace('CCR') } |
94
|
0
|
|
|
0
|
|
|
sub _build_cluster { shift->_build_namespace('Cluster') } |
95
|
0
|
|
|
0
|
|
|
sub _build_dangling_indices { shift->_build_namespace('DanglingIndices') } |
96
|
0
|
|
|
0
|
|
|
sub _build_data_frame_transform_deprecated { shift->_build_namespace('DataFrameTransformDeprecated') } |
97
|
0
|
|
|
0
|
|
|
sub _build_enrich { shift->_build_namespace('Enrich') } |
98
|
0
|
|
|
0
|
|
|
sub _build_eql { shift->_build_namespace('Eql') } |
99
|
0
|
|
|
0
|
|
|
sub _build_features { shift->_build_namespace('Features') } |
100
|
0
|
|
|
0
|
|
|
sub _build_fleet { shift->_build_namespace('Fleet') } |
101
|
0
|
|
|
0
|
|
|
sub _build_graph { shift->_build_namespace('Graph') } |
102
|
0
|
|
|
0
|
|
|
sub _build_ilm { shift->_build_namespace('ILM') } |
103
|
0
|
|
|
0
|
|
|
sub _build_indices { shift->_build_namespace('Indices') } |
104
|
0
|
|
|
0
|
|
|
sub _build_ingest { shift->_build_namespace('Ingest') } |
105
|
0
|
|
|
0
|
|
|
sub _build_license { shift->_build_namespace('License') } |
106
|
0
|
|
|
0
|
|
|
sub _build_logstash { shift->_build_namespace('Logstash') } |
107
|
0
|
|
|
0
|
|
|
sub _build_migration { shift->_build_namespace('Migration') } |
108
|
0
|
|
|
0
|
|
|
sub _build_ml { shift->_build_namespace('ML') } |
109
|
0
|
|
|
0
|
|
|
sub _build_monitoring { shift->_build_namespace('Monitoring') } |
110
|
0
|
|
|
0
|
|
|
sub _build_nodes { shift->_build_namespace('Nodes') } |
111
|
0
|
|
|
0
|
|
|
sub _build_rollup { shift->_build_namespace('Rollup') } |
112
|
0
|
|
|
0
|
|
|
sub _build_searchable_snapshots { shift->_build_namespace('SearchableSnapshots') } |
113
|
0
|
|
|
0
|
|
|
sub _build_security { shift->_build_namespace('Security') } |
114
|
0
|
|
|
0
|
|
|
sub _build_shutdown { shift->_build_namespace('Shutdown') } |
115
|
0
|
|
|
0
|
|
|
sub _build_snapshot { shift->_build_namespace('Snapshot') } |
116
|
0
|
|
|
0
|
|
|
sub _build_slm { shift->_build_namespace('Slm') } |
117
|
0
|
|
|
0
|
|
|
sub _build_sql { shift->_build_namespace('SQL') } |
118
|
0
|
|
|
0
|
|
|
sub _build_ssl { shift->_build_namespace('SSL') } |
119
|
0
|
|
|
0
|
|
|
sub _build_tasks { shift->_build_namespace('Tasks') } |
120
|
0
|
|
|
0
|
|
|
sub _build_text_structure { shift->_build_namespace('TextStructure') } |
121
|
0
|
|
|
0
|
|
|
sub _build_transform { shift->_build_namespace('Transform') } |
122
|
0
|
|
|
0
|
|
|
sub _build_watcher { shift->_build_namespace('Watcher') } |
123
|
0
|
|
|
0
|
|
|
sub _build_xpack { shift->_build_namespace('XPack') } |
124
|
|
|
|
|
|
|
#=================================== |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__PACKAGE__->_install_api(''); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=pod |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=encoding UTF-8 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 NAME |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Search::Elasticsearch::Client::7_0::Direct - Thin client with full support for Elasticsearch 7.x APIs |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 VERSION |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
version 7.717 |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SYNOPSIS |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Create a client: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
use Search::Elasticsearch; |
147
|
|
|
|
|
|
|
my $e = Search::Elasticsearch->new( |
148
|
|
|
|
|
|
|
client => '7_0::Direct' |
149
|
|
|
|
|
|
|
); |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Index a doc: |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$e->index( |
154
|
|
|
|
|
|
|
index => 'my_index', |
155
|
|
|
|
|
|
|
type => 'blog_post', |
156
|
|
|
|
|
|
|
id => 123, |
157
|
|
|
|
|
|
|
body => { |
158
|
|
|
|
|
|
|
title => "Elasticsearch clients", |
159
|
|
|
|
|
|
|
content => "Interesting content...", |
160
|
|
|
|
|
|
|
date => "2013-09-23" |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Get a doc: |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
$e->get( |
167
|
|
|
|
|
|
|
index => 'my_index', |
168
|
|
|
|
|
|
|
type => 'my_type', |
169
|
|
|
|
|
|
|
id => 123 |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Search for docs: |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
$results = $e->search( |
175
|
|
|
|
|
|
|
index => 'my_index', |
176
|
|
|
|
|
|
|
body => { |
177
|
|
|
|
|
|
|
query => { |
178
|
|
|
|
|
|
|
match => { |
179
|
|
|
|
|
|
|
title => "elasticsearch" |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
); |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Index-level requests: |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$e->indices->create( index => 'my_index' ); |
188
|
|
|
|
|
|
|
$e->indices->delete( index => 'my_index' ) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Ingest pipeline requests: |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$e->ingest->get_pipeline( id => 'apache-logs' ); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Cluster-level requests: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
$health = $e->cluster->health; |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Node-level requests: |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
$info = $e->nodes->info; |
201
|
|
|
|
|
|
|
$stats = $e->nodes->stats; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Snapshot and restore: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$e->snapshot->create_repository( |
206
|
|
|
|
|
|
|
repository => 'my_backups', |
207
|
|
|
|
|
|
|
type => 'fs', |
208
|
|
|
|
|
|
|
settings => { |
209
|
|
|
|
|
|
|
location => '/mnt/backups' |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
); |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
$e->snapshot->create( |
214
|
|
|
|
|
|
|
repository => 'my_backups', |
215
|
|
|
|
|
|
|
snapshot => 'backup_2014' |
216
|
|
|
|
|
|
|
); |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Task management: |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
$e->tasks->list; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
`cat` debugging: |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
say $e->cat->allocation; |
225
|
|
|
|
|
|
|
say $e->cat->health; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Cross-cluster replication requests: |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
say $e->ccr->follow; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Index lifecycle management requests: |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
say $e->ilm->put_lifecycle; |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 DESCRIPTION |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
The L class provides the |
238
|
|
|
|
|
|
|
Elasticsearch 7.x compatible client returned by: |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
$e = Search::Elasticsearch->new( |
241
|
|
|
|
|
|
|
client => "7_0::Direct" # default |
242
|
|
|
|
|
|
|
); |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
It is intended to be as close as possible to the native REST API that |
245
|
|
|
|
|
|
|
Elasticsearch uses, so that it is easy to translate the |
246
|
|
|
|
|
|
|
L |
247
|
|
|
|
|
|
|
for an API to the equivalent in this client. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
This class provides the methods for L, |
250
|
|
|
|
|
|
|
L and L. |
251
|
|
|
|
|
|
|
It also provides access to clients for managing L |
252
|
|
|
|
|
|
|
and the L. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 PREVIOUS VERSIONS OF ELASTICSEARCH |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This version of the client supports the Elasticsearch 7.0 branch, |
257
|
|
|
|
|
|
|
which is not backwards compatible with earlier branches. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
If you need to talk to a version of Elasticsearch before 7.0.0, please |
260
|
|
|
|
|
|
|
install one of the following modules: |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=over |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item * |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
L |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item * |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
L |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=item * |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
L |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=item * |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
L |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=item * |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
L |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=back |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 CONVENTIONS |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head2 Parameter passing |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Parameters can be passed to any request method as a list or as a hash |
291
|
|
|
|
|
|
|
reference. The following two statements are equivalent: |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
$e->search( size => 10 ); |
294
|
|
|
|
|
|
|
$e->search({size => 10}); |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head2 Path parameters |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Any values that should be included in the URL path, eg C{index}/{type}> |
299
|
|
|
|
|
|
|
should be passed as top level parameters: |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
$e->search( index => 'my_index', type => 'my_type' ); |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Alternatively, you can specify a C parameter directly: |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
$e->search( path => '/my_index/my_type' ); |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 Query-string parameters |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
Any values that should be included in the query string should be passed |
310
|
|
|
|
|
|
|
as top level parameters: |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
$e->search( size => 10 ); |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
If you pass in a C<\%params> hash, then it will be included in the |
315
|
|
|
|
|
|
|
query string parameters without any error checking. The following: |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
$e->search( size => 10, params => { from => 6, size => 6 }) |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
would result in this query string: |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
?from=6&size=10 |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=head2 Body parameter |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
The request body should be passed in the C key: |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
$e->search( |
328
|
|
|
|
|
|
|
body => { |
329
|
|
|
|
|
|
|
query => {...} |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
); |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
The body can also be a UTF8-decoded string, which will be converted into |
334
|
|
|
|
|
|
|
UTF-8 bytes and passed as is: |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
$e->indices->analyze( body => "The quick brown fox"); |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head2 Boolean parameters |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
Elasticsearch 7.0.0 and above no longer accepts truthy and falsey values for booleans. Instead, |
341
|
|
|
|
|
|
|
it will accept only a JSON C or C, or the string equivalents C<"true"> or C<"false">. |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
In the Perl client, you can use the following values: |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=over |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=item * True: C, C<\1>, or a L object. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item * False: C, C<\0>, or a L object. |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=back |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head2 Filter path parameter |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
Any API which returns a JSON body accepts a C parameter |
356
|
|
|
|
|
|
|
which will filter the JSON down to only the specified paths. For instance, |
357
|
|
|
|
|
|
|
if you are running a search request and only want the C hits and |
358
|
|
|
|
|
|
|
the C<_source> field for each hit (without the C<_id>, C<_index> etc), |
359
|
|
|
|
|
|
|
you can do: |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
$e->search( |
362
|
|
|
|
|
|
|
query => {...}, |
363
|
|
|
|
|
|
|
filter_paths => [ 'hits.total', 'hits.hits._source' ] |
364
|
|
|
|
|
|
|
); |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=head2 Ignore parameter |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
Normally, any HTTP status code outside the 200-299 range will result in |
369
|
|
|
|
|
|
|
an error being thrown. To suppress these errors, you can specify which |
370
|
|
|
|
|
|
|
status codes to ignore in the C parameter. |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
$e->indices->delete( |
373
|
|
|
|
|
|
|
index => 'my_index', |
374
|
|
|
|
|
|
|
ignore => 404 |
375
|
|
|
|
|
|
|
); |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
This is most useful for |
378
|
|
|
|
|
|
|
L errors, which |
379
|
|
|
|
|
|
|
are triggered by a C<404> status code when some requested resource does |
380
|
|
|
|
|
|
|
not exist. |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
Multiple error codes can be specified with an array: |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
$e->indices->delete( |
385
|
|
|
|
|
|
|
index => 'my_index', |
386
|
|
|
|
|
|
|
ignore => [404,409] |
387
|
|
|
|
|
|
|
); |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=head1 CONFIGURATION |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head2 C |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
The class to use for the L method. Defaults to |
394
|
|
|
|
|
|
|
L. |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=head2 C |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
The class to use for the L method. Defaults to |
399
|
|
|
|
|
|
|
L. |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head1 GENERAL METHODS |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=head2 C |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
$info = $e->info |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Returns information about the version of Elasticsearch that the responding node |
408
|
|
|
|
|
|
|
is running. |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=head2 C |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
$e->ping |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
Pings a node in the cluster and returns C<1> if it receives a C<200> |
415
|
|
|
|
|
|
|
response, otherwise it throws an error. |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=head2 C |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
$indices_client = $e->indices; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
Returns a L object which can be used |
422
|
|
|
|
|
|
|
for managing indices, eg creating, deleting indices, managing mapping, |
423
|
|
|
|
|
|
|
index settings etc. |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=head2 C |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
$ingest_client = $e->ingest; |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Returns a L object which can be used |
430
|
|
|
|
|
|
|
for managing ingest pipelines. |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=head2 C |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
$cluster_client = $e->cluster; |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
Returns a L object which can be used |
437
|
|
|
|
|
|
|
for managing the cluster, eg cluster-wide settings and cluster health. |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=head2 C |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
$node_client = $e->nodes; |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
Returns a L object which can be used |
444
|
|
|
|
|
|
|
to retrieve node info and stats. |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
=head2 C |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
$snapshot_client = $e->snapshot; |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
Returns a L object which |
451
|
|
|
|
|
|
|
is used for managing backup repositories and creating and restoring |
452
|
|
|
|
|
|
|
snapshots. |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head2 C |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
$tasks_client = $e->tasks; |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Returns a L object which |
459
|
|
|
|
|
|
|
is used for accessing the task management API. |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=head2 C |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
$cat_client = $e->cat; |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Returns a L object which can be used |
466
|
|
|
|
|
|
|
to retrieve simple to read text info for debugging and monitoring an |
467
|
|
|
|
|
|
|
Elasticsearch cluster. |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head2 C |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
$ccr_client = $e->ccr; |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Returns a L object which can be used |
474
|
|
|
|
|
|
|
to handle cross-cluster replication requests. |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head2 C |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
$ilm_client = $e->ilm; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
Returns a L object which can be used |
481
|
|
|
|
|
|
|
to handle index lifecycle management requests. |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=head1 DOCUMENT CRUD METHODS |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
These methods allow you to perform create, index, update and delete requests |
486
|
|
|
|
|
|
|
for single documents: |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=head2 C |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
$response = $e->index( |
491
|
|
|
|
|
|
|
index => 'index_name', # required |
492
|
|
|
|
|
|
|
type => 'type_name', # required |
493
|
|
|
|
|
|
|
id => 'doc_id', # optional, otherwise auto-generated |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
body => { document } # required |
496
|
|
|
|
|
|
|
); |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
The C method is used to index a new document or to reindex |
499
|
|
|
|
|
|
|
an existing document. |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
Query string parameters: |
502
|
|
|
|
|
|
|
C, |
503
|
|
|
|
|
|
|
C, |
504
|
|
|
|
|
|
|
C, |
505
|
|
|
|
|
|
|
C, |
506
|
|
|
|
|
|
|
C, |
507
|
|
|
|
|
|
|
C, |
508
|
|
|
|
|
|
|
C, |
509
|
|
|
|
|
|
|
C, |
510
|
|
|
|
|
|
|
C, |
511
|
|
|
|
|
|
|
C, |
512
|
|
|
|
|
|
|
C, |
513
|
|
|
|
|
|
|
C, |
514
|
|
|
|
|
|
|
C |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
See the L |
517
|
|
|
|
|
|
|
for more information. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=head2 C |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
$response = $e->create( |
522
|
|
|
|
|
|
|
index => 'index_name', # required |
523
|
|
|
|
|
|
|
type => 'type_name', # required |
524
|
|
|
|
|
|
|
id => 'doc_id', # required |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
body => { document } # required |
527
|
|
|
|
|
|
|
); |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
The C method works exactly like the L method, except |
530
|
|
|
|
|
|
|
that it will throw a C error if a document with the same |
531
|
|
|
|
|
|
|
C, C and C already exists. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
Query string parameters: |
534
|
|
|
|
|
|
|
C, |
535
|
|
|
|
|
|
|
C, |
536
|
|
|
|
|
|
|
C, |
537
|
|
|
|
|
|
|
C, |
538
|
|
|
|
|
|
|
C, |
539
|
|
|
|
|
|
|
C, |
540
|
|
|
|
|
|
|
C, |
541
|
|
|
|
|
|
|
C, |
542
|
|
|
|
|
|
|
C, |
543
|
|
|
|
|
|
|
C |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
See the L |
546
|
|
|
|
|
|
|
for more information. |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=head2 C |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
$response = $e->get( |
551
|
|
|
|
|
|
|
index => 'index_name', # required |
552
|
|
|
|
|
|
|
type => 'type_name', # required |
553
|
|
|
|
|
|
|
id => 'doc_id', # required |
554
|
|
|
|
|
|
|
); |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
The C method will retrieve the document with the specified |
557
|
|
|
|
|
|
|
C, C and C, or will throw a C error. |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
Query string parameters: |
560
|
|
|
|
|
|
|
C<_source>, |
561
|
|
|
|
|
|
|
C<_source_excludes>, |
562
|
|
|
|
|
|
|
C<_source_includes>, |
563
|
|
|
|
|
|
|
C, |
564
|
|
|
|
|
|
|
C, |
565
|
|
|
|
|
|
|
C, |
566
|
|
|
|
|
|
|
C, |
567
|
|
|
|
|
|
|
C, |
568
|
|
|
|
|
|
|
C, |
569
|
|
|
|
|
|
|
C, |
570
|
|
|
|
|
|
|
C, |
571
|
|
|
|
|
|
|
C, |
572
|
|
|
|
|
|
|
C |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
See the L |
575
|
|
|
|
|
|
|
for more information. |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 C |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
$response = $e->get_source( |
580
|
|
|
|
|
|
|
index => 'index_name', # required |
581
|
|
|
|
|
|
|
type => 'type_name', # required |
582
|
|
|
|
|
|
|
id => 'doc_id', # required |
583
|
|
|
|
|
|
|
); |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
The C method works just like the L method except that |
586
|
|
|
|
|
|
|
it returns just the C<_source> field (the value of the C parameter |
587
|
|
|
|
|
|
|
in the L method) instead of returning the C<_source> field |
588
|
|
|
|
|
|
|
plus the document metadata, ie the C<_index>, C<_type> etc. |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
Query string parameters: |
591
|
|
|
|
|
|
|
C<_source>, |
592
|
|
|
|
|
|
|
C<_source_excludes>, |
593
|
|
|
|
|
|
|
C<_source_includes>, |
594
|
|
|
|
|
|
|
C, |
595
|
|
|
|
|
|
|
C, |
596
|
|
|
|
|
|
|
C, |
597
|
|
|
|
|
|
|
C, |
598
|
|
|
|
|
|
|
C, |
599
|
|
|
|
|
|
|
C, |
600
|
|
|
|
|
|
|
C, |
601
|
|
|
|
|
|
|
C, |
602
|
|
|
|
|
|
|
C |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
See the L |
605
|
|
|
|
|
|
|
for more information. |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
=head2 C |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
$response = $e->exists( |
610
|
|
|
|
|
|
|
index => 'index_name', # required |
611
|
|
|
|
|
|
|
type => 'type_name', # required |
612
|
|
|
|
|
|
|
id => 'doc_id', # required |
613
|
|
|
|
|
|
|
); |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
The C method returns C<1> if a document with the specified |
616
|
|
|
|
|
|
|
C, C and C exists, or an empty string if it doesn't. |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
Query string parameters: |
619
|
|
|
|
|
|
|
C<_source>, |
620
|
|
|
|
|
|
|
C<_source_excludes>, |
621
|
|
|
|
|
|
|
C<_source_includes>, |
622
|
|
|
|
|
|
|
C, |
623
|
|
|
|
|
|
|
C, |
624
|
|
|
|
|
|
|
C, |
625
|
|
|
|
|
|
|
C, |
626
|
|
|
|
|
|
|
C, |
627
|
|
|
|
|
|
|
C, |
628
|
|
|
|
|
|
|
C, |
629
|
|
|
|
|
|
|
C, |
630
|
|
|
|
|
|
|
C |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
See the L |
633
|
|
|
|
|
|
|
for more information. |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=head2 C |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
$response = $e->delete( |
638
|
|
|
|
|
|
|
index => 'index_name', # required |
639
|
|
|
|
|
|
|
type => 'type_name', # required |
640
|
|
|
|
|
|
|
id => 'doc_id', # required |
641
|
|
|
|
|
|
|
); |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
The C method will delete the document with the specified |
644
|
|
|
|
|
|
|
C, C and C, or will throw a C error. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
Query string parameters: |
647
|
|
|
|
|
|
|
C, |
648
|
|
|
|
|
|
|
C, |
649
|
|
|
|
|
|
|
C, |
650
|
|
|
|
|
|
|
C, |
651
|
|
|
|
|
|
|
C, |
652
|
|
|
|
|
|
|
C, |
653
|
|
|
|
|
|
|
C, |
654
|
|
|
|
|
|
|
C, |
655
|
|
|
|
|
|
|
C, |
656
|
|
|
|
|
|
|
C, |
657
|
|
|
|
|
|
|
C |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
See the L |
660
|
|
|
|
|
|
|
for more information. |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=head2 C |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
$response = $e->update( |
665
|
|
|
|
|
|
|
index => 'index_name', # required |
666
|
|
|
|
|
|
|
type => 'type_name', # required |
667
|
|
|
|
|
|
|
id => 'doc_id', # required |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
body => { update } # required |
670
|
|
|
|
|
|
|
); |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
The C method updates a document with the corresponding |
673
|
|
|
|
|
|
|
C, C and C if it exists. Updates can be performed either by: |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=over |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=item * providing a partial document to be merged in to the existing document: |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
$response = $e->update( |
680
|
|
|
|
|
|
|
..., |
681
|
|
|
|
|
|
|
body => { |
682
|
|
|
|
|
|
|
doc => { new_field => 'new_value'}, |
683
|
|
|
|
|
|
|
} |
684
|
|
|
|
|
|
|
); |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=item * with an inline script: |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
$response = $e->update( |
689
|
|
|
|
|
|
|
..., |
690
|
|
|
|
|
|
|
body => { |
691
|
|
|
|
|
|
|
script => { |
692
|
|
|
|
|
|
|
source => "ctx._source.counter += incr", |
693
|
|
|
|
|
|
|
params => { incr => 6 } |
694
|
|
|
|
|
|
|
} |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
); |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=item * with an indexed script: |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
$response = $e->update( |
701
|
|
|
|
|
|
|
..., |
702
|
|
|
|
|
|
|
body => { |
703
|
|
|
|
|
|
|
script => { |
704
|
|
|
|
|
|
|
id => $id, |
705
|
|
|
|
|
|
|
lang => 'painless', |
706
|
|
|
|
|
|
|
params => { incr => 6 } |
707
|
|
|
|
|
|
|
} |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
); |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
See L |
712
|
|
|
|
|
|
|
for more information. |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
=item * with a script stored as a file: |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
$response = $e->update( |
717
|
|
|
|
|
|
|
..., |
718
|
|
|
|
|
|
|
body => { |
719
|
|
|
|
|
|
|
script => { |
720
|
|
|
|
|
|
|
file => 'counter', |
721
|
|
|
|
|
|
|
lang => 'painless', |
722
|
|
|
|
|
|
|
params => { incr => 6 } |
723
|
|
|
|
|
|
|
} |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
); |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
See L |
728
|
|
|
|
|
|
|
for more information. |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=back |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
Query string parameters: |
733
|
|
|
|
|
|
|
C<_source>, |
734
|
|
|
|
|
|
|
C<_source_excludes>, |
735
|
|
|
|
|
|
|
C<_source_includes>, |
736
|
|
|
|
|
|
|
C, |
737
|
|
|
|
|
|
|
C, |
738
|
|
|
|
|
|
|
C, |
739
|
|
|
|
|
|
|
C, |
740
|
|
|
|
|
|
|
C, |
741
|
|
|
|
|
|
|
C, |
742
|
|
|
|
|
|
|
C, |
743
|
|
|
|
|
|
|
C, |
744
|
|
|
|
|
|
|
C, |
745
|
|
|
|
|
|
|
C, |
746
|
|
|
|
|
|
|
C, |
747
|
|
|
|
|
|
|
C, |
748
|
|
|
|
|
|
|
C, |
749
|
|
|
|
|
|
|
C |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
See the L |
752
|
|
|
|
|
|
|
for more information. |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 C |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
$results = $e->termvectors( |
757
|
|
|
|
|
|
|
index => $index, # required |
758
|
|
|
|
|
|
|
type => $type, # required |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
id => $id, # optional |
761
|
|
|
|
|
|
|
body => {...} # optional |
762
|
|
|
|
|
|
|
) |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
The C method retrieves term and field statistics, positions, |
765
|
|
|
|
|
|
|
offsets and payloads for the specified document, assuming that termvectors |
766
|
|
|
|
|
|
|
have been enabled. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
Query string parameters: |
769
|
|
|
|
|
|
|
C, |
770
|
|
|
|
|
|
|
C, |
771
|
|
|
|
|
|
|
C, |
772
|
|
|
|
|
|
|
C, |
773
|
|
|
|
|
|
|
C, |
774
|
|
|
|
|
|
|
C, |
775
|
|
|
|
|
|
|
C, |
776
|
|
|
|
|
|
|
C, |
777
|
|
|
|
|
|
|
C, |
778
|
|
|
|
|
|
|
C, |
779
|
|
|
|
|
|
|
C, |
780
|
|
|
|
|
|
|
C, |
781
|
|
|
|
|
|
|
C, |
782
|
|
|
|
|
|
|
C |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
See the L |
785
|
|
|
|
|
|
|
for more information. |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=head1 BULK DOCUMENT CRUD METHODS |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
The bulk document CRUD methods are used for running multiple CRUD actions |
790
|
|
|
|
|
|
|
within a single request. By reducing the number of network requests |
791
|
|
|
|
|
|
|
that need to be made, bulk requests greatly improve performance. |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=head2 C |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
$response = $e->bulk( |
796
|
|
|
|
|
|
|
index => 'index_name', # required if type specified |
797
|
|
|
|
|
|
|
type => 'type_name', # optional |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
body => [ actions ] # required |
800
|
|
|
|
|
|
|
); |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
See L and L for a helper module that makes |
803
|
|
|
|
|
|
|
bulk indexing simpler to use. |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
The C method can perform multiple L, L, |
806
|
|
|
|
|
|
|
L or L actions with a single request. The C |
807
|
|
|
|
|
|
|
parameter expects an array containing the list of actions to perform. |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
An I consists of an initial metadata hash ref containing the action |
810
|
|
|
|
|
|
|
type, plus the associated metadata, eg : |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
{ delete => { _index => 'index', _type => 'type', _id => 123 }} |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
The C and C actions then expect a hashref containing |
815
|
|
|
|
|
|
|
the document itself: |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
{ create => { _index => 'index', _type => 'type', _id => 123 }}, |
818
|
|
|
|
|
|
|
{ title => "A newly created document" } |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
And the C action expects a hashref containing the update commands, |
821
|
|
|
|
|
|
|
eg: |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
{ update => { _index => 'index', _type => 'type', _id => 123 }}, |
824
|
|
|
|
|
|
|
{ script => "ctx._source.counter+=1" } |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
Each action can include the same parameters that you would pass to |
827
|
|
|
|
|
|
|
the equivalent L, L, L or L |
828
|
|
|
|
|
|
|
request, except that C<_index>, C<_type> and C<_id> must be specified with |
829
|
|
|
|
|
|
|
the preceding underscore. All other parameters can be specified with or |
830
|
|
|
|
|
|
|
without the underscore. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
For instance: |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
$response = $e->bulk( |
835
|
|
|
|
|
|
|
index => 'index_name', # default index name |
836
|
|
|
|
|
|
|
type => 'type_name', # default type name |
837
|
|
|
|
|
|
|
body => [ |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
# create action |
840
|
|
|
|
|
|
|
{ create => { |
841
|
|
|
|
|
|
|
_index => 'not_the_default_index', |
842
|
|
|
|
|
|
|
_type => 'not_the_default_type', |
843
|
|
|
|
|
|
|
_id => 123 |
844
|
|
|
|
|
|
|
}}, |
845
|
|
|
|
|
|
|
{ title => 'Foo' }, |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
# index action |
848
|
|
|
|
|
|
|
{ index => { _id => 124 }}, |
849
|
|
|
|
|
|
|
{ title => 'Foo' }, |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
# delete action |
852
|
|
|
|
|
|
|
{ delete => { _id => 126 }}, |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
# update action |
855
|
|
|
|
|
|
|
{ update => { _id => 126 }}, |
856
|
|
|
|
|
|
|
{ script => "ctx._source.counter+1" } |
857
|
|
|
|
|
|
|
] |
858
|
|
|
|
|
|
|
); |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
Each action is performed separately. One failed action will not |
861
|
|
|
|
|
|
|
cause the others to fail as well. |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
Query string parameters: |
864
|
|
|
|
|
|
|
C<_source>, |
865
|
|
|
|
|
|
|
C<_source_excludes>, |
866
|
|
|
|
|
|
|
C<_source_includes>, |
867
|
|
|
|
|
|
|
C, |
868
|
|
|
|
|
|
|
C, |
869
|
|
|
|
|
|
|
C, |
870
|
|
|
|
|
|
|
C, |
871
|
|
|
|
|
|
|
C, |
872
|
|
|
|
|
|
|
C, |
873
|
|
|
|
|
|
|
C, |
874
|
|
|
|
|
|
|
C |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
See the L |
877
|
|
|
|
|
|
|
for more information. |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=head2 C |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
$bulk_helper = $e->bulk_helper( @args ); |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
Returns a new instance of the class specified in the L, |
884
|
|
|
|
|
|
|
which defaults to L. |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=head2 C |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
$results = $e->mget( |
889
|
|
|
|
|
|
|
index => 'default_index', # optional, required when type specified |
890
|
|
|
|
|
|
|
type => 'default_type', # optional |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
body => { docs or ids } # required |
893
|
|
|
|
|
|
|
); |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
The C method will retrieve multiple documents with a single request. |
896
|
|
|
|
|
|
|
The C consists of an array of documents to retrieve: |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
$results = $e->mget( |
899
|
|
|
|
|
|
|
index => 'default_index', |
900
|
|
|
|
|
|
|
type => 'default_type', |
901
|
|
|
|
|
|
|
body => { |
902
|
|
|
|
|
|
|
docs => [ |
903
|
|
|
|
|
|
|
{ _id => 1}, |
904
|
|
|
|
|
|
|
{ _id => 2, _type => 'not_the_default_type' } |
905
|
|
|
|
|
|
|
] |
906
|
|
|
|
|
|
|
} |
907
|
|
|
|
|
|
|
); |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
You can also pass any of the other parameters that the L request |
910
|
|
|
|
|
|
|
accepts. |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
If you have specified an C and C, you can just include the |
913
|
|
|
|
|
|
|
C of the documents to retrieve: |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
$results = $e->mget( |
916
|
|
|
|
|
|
|
index => 'default_index', |
917
|
|
|
|
|
|
|
type => 'default_type', |
918
|
|
|
|
|
|
|
body => { |
919
|
|
|
|
|
|
|
ids => [ 1, 2, 3] |
920
|
|
|
|
|
|
|
} |
921
|
|
|
|
|
|
|
); |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
Query string parameters: |
924
|
|
|
|
|
|
|
C<_source>, |
925
|
|
|
|
|
|
|
C<_source_excludes>, |
926
|
|
|
|
|
|
|
C<_source_includes>, |
927
|
|
|
|
|
|
|
C, |
928
|
|
|
|
|
|
|
C, |
929
|
|
|
|
|
|
|
C, |
930
|
|
|
|
|
|
|
C, |
931
|
|
|
|
|
|
|
C, |
932
|
|
|
|
|
|
|
C, |
933
|
|
|
|
|
|
|
C |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
See the L |
936
|
|
|
|
|
|
|
for more information. |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
=head2 C |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
$results = $e->mtermvectors( |
941
|
|
|
|
|
|
|
index => $index, # required if type specified |
942
|
|
|
|
|
|
|
type => $type, # optional |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
body => { } # optional |
945
|
|
|
|
|
|
|
) |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
Runs multiple L requests in a single request, eg: |
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
$results = $e->mtermvectors( |
950
|
|
|
|
|
|
|
index => 'test', |
951
|
|
|
|
|
|
|
body => { |
952
|
|
|
|
|
|
|
docs => [ |
953
|
|
|
|
|
|
|
{ _type => 'test', _id => 1, fields => ['text'] }, |
954
|
|
|
|
|
|
|
{ _type => 'test', _id => 2, payloads => 1 }, |
955
|
|
|
|
|
|
|
] |
956
|
|
|
|
|
|
|
} |
957
|
|
|
|
|
|
|
); |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
Query string parameters: |
960
|
|
|
|
|
|
|
C, |
961
|
|
|
|
|
|
|
C, |
962
|
|
|
|
|
|
|
C, |
963
|
|
|
|
|
|
|
C, |
964
|
|
|
|
|
|
|
C, |
965
|
|
|
|
|
|
|
C, |
966
|
|
|
|
|
|
|
C, |
967
|
|
|
|
|
|
|
C, |
968
|
|
|
|
|
|
|
C, |
969
|
|
|
|
|
|
|
C, |
970
|
|
|
|
|
|
|
C, |
971
|
|
|
|
|
|
|
C, |
972
|
|
|
|
|
|
|
C, |
973
|
|
|
|
|
|
|
C, |
974
|
|
|
|
|
|
|
C |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
See the L |
977
|
|
|
|
|
|
|
for more information. |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
=head1 SEARCH METHODS |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
The search methods are used for querying documents in one, more or all indices |
982
|
|
|
|
|
|
|
and of one, more or all types: |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
=head2 C |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
$results = $e->search( |
987
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
988
|
|
|
|
|
|
|
type => 'type' | \@types, # optional |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
body => { search params } # optional |
991
|
|
|
|
|
|
|
); |
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
The C method searches for matching documents in one or more |
994
|
|
|
|
|
|
|
indices. It is just as easy to search a single index as it is to search |
995
|
|
|
|
|
|
|
all the indices in your cluster. It can also return |
996
|
|
|
|
|
|
|
L |
997
|
|
|
|
|
|
|
L |
998
|
|
|
|
|
|
|
and L |
999
|
|
|
|
|
|
|
or L |
1000
|
|
|
|
|
|
|
suggestions. |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
The I L |
1003
|
|
|
|
|
|
|
allows you to specify a query string in the C parameter, using the |
1004
|
|
|
|
|
|
|
Lucene query string syntax: |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
$results = $e->search( q => 'title:(elasticsearch clients)'); |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
However, the preferred way to search is by using the |
1009
|
|
|
|
|
|
|
L |
1010
|
|
|
|
|
|
|
to create a query, and passing that C in the |
1011
|
|
|
|
|
|
|
L: |
1012
|
|
|
|
|
|
|
|
1013
|
|
|
|
|
|
|
$results = $e->search( |
1014
|
|
|
|
|
|
|
body => { |
1015
|
|
|
|
|
|
|
query => { |
1016
|
|
|
|
|
|
|
match => { title => 'Elasticsearch clients'} |
1017
|
|
|
|
|
|
|
} |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
); |
1020
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
Query string parameters: |
1022
|
|
|
|
|
|
|
C<_source>, |
1023
|
|
|
|
|
|
|
C<_source_excludes>, |
1024
|
|
|
|
|
|
|
C<_source_includes>, |
1025
|
|
|
|
|
|
|
C, |
1026
|
|
|
|
|
|
|
C, |
1027
|
|
|
|
|
|
|
C, |
1028
|
|
|
|
|
|
|
C, |
1029
|
|
|
|
|
|
|
C, |
1030
|
|
|
|
|
|
|
C, |
1031
|
|
|
|
|
|
|
C, |
1032
|
|
|
|
|
|
|
C, |
1033
|
|
|
|
|
|
|
C, |
1034
|
|
|
|
|
|
|
C, |
1035
|
|
|
|
|
|
|
C, |
1036
|
|
|
|
|
|
|
C, |
1037
|
|
|
|
|
|
|
C, |
1038
|
|
|
|
|
|
|
C, |
1039
|
|
|
|
|
|
|
C, |
1040
|
|
|
|
|
|
|
C, |
1041
|
|
|
|
|
|
|
C, |
1042
|
|
|
|
|
|
|
C, |
1043
|
|
|
|
|
|
|
C, |
1044
|
|
|
|
|
|
|
C, |
1045
|
|
|
|
|
|
|
C, |
1046
|
|
|
|
|
|
|
C, |
1047
|
|
|
|
|
|
|
C, |
1048
|
|
|
|
|
|
|
C, |
1049
|
|
|
|
|
|
|
C, |
1050
|
|
|
|
|
|
|
C, |
1051
|
|
|
|
|
|
|
C, |
1052
|
|
|
|
|
|
|
C, |
1053
|
|
|
|
|
|
|
C, |
1054
|
|
|
|
|
|
|
C, |
1055
|
|
|
|
|
|
|
C, |
1056
|
|
|
|
|
|
|
C, |
1057
|
|
|
|
|
|
|
C, |
1058
|
|
|
|
|
|
|
C, |
1059
|
|
|
|
|
|
|
C, |
1060
|
|
|
|
|
|
|
C, |
1061
|
|
|
|
|
|
|
C, |
1062
|
|
|
|
|
|
|
C, |
1063
|
|
|
|
|
|
|
C, |
1064
|
|
|
|
|
|
|
C |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
See the L |
1067
|
|
|
|
|
|
|
for more information. |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
Also see L. |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
=head2 C |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
$results = $e->count( |
1074
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1075
|
|
|
|
|
|
|
type => 'type' | \@types, # optional |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
body => { query } # optional |
1078
|
|
|
|
|
|
|
) |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
The C method returns the total count of all documents matching the |
1081
|
|
|
|
|
|
|
query: |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
$results = $e->count( |
1084
|
|
|
|
|
|
|
body => { |
1085
|
|
|
|
|
|
|
query => { |
1086
|
|
|
|
|
|
|
match => { title => 'Elasticsearch clients' } |
1087
|
|
|
|
|
|
|
} |
1088
|
|
|
|
|
|
|
} |
1089
|
|
|
|
|
|
|
); |
1090
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
Query string parameters: |
1092
|
|
|
|
|
|
|
C, |
1093
|
|
|
|
|
|
|
C, |
1094
|
|
|
|
|
|
|
C, |
1095
|
|
|
|
|
|
|
C, |
1096
|
|
|
|
|
|
|
C, |
1097
|
|
|
|
|
|
|
C, |
1098
|
|
|
|
|
|
|
C, |
1099
|
|
|
|
|
|
|
C, |
1100
|
|
|
|
|
|
|
C, |
1101
|
|
|
|
|
|
|
C, |
1102
|
|
|
|
|
|
|
C, |
1103
|
|
|
|
|
|
|
C |
1104
|
|
|
|
|
|
|
C, |
1105
|
|
|
|
|
|
|
C, |
1106
|
|
|
|
|
|
|
C, |
1107
|
|
|
|
|
|
|
C, |
1108
|
|
|
|
|
|
|
C |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
See the L |
1111
|
|
|
|
|
|
|
for more information. |
1112
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
=head2 C |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
$results = $e->search_template( |
1116
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1117
|
|
|
|
|
|
|
type => 'type' | \@types, # optional |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
body => { search params } # required |
1120
|
|
|
|
|
|
|
); |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
Perform a search by specifying a template (either predefined or defined |
1123
|
|
|
|
|
|
|
within the C) and parameters to use with the template, eg: |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
$results = $e->search_template( |
1126
|
|
|
|
|
|
|
body => { |
1127
|
|
|
|
|
|
|
source => { |
1128
|
|
|
|
|
|
|
query => { |
1129
|
|
|
|
|
|
|
match => { |
1130
|
|
|
|
|
|
|
"{{my_field}}" => "{{my_value}}" |
1131
|
|
|
|
|
|
|
} |
1132
|
|
|
|
|
|
|
}, |
1133
|
|
|
|
|
|
|
size => "{{my_size}}" |
1134
|
|
|
|
|
|
|
}, |
1135
|
|
|
|
|
|
|
params => { |
1136
|
|
|
|
|
|
|
my_field => 'foo', |
1137
|
|
|
|
|
|
|
my_value => 'bar', |
1138
|
|
|
|
|
|
|
my_size => 6 |
1139
|
|
|
|
|
|
|
} |
1140
|
|
|
|
|
|
|
} |
1141
|
|
|
|
|
|
|
); |
1142
|
|
|
|
|
|
|
|
1143
|
|
|
|
|
|
|
See the L |
1144
|
|
|
|
|
|
|
for more information. |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
Query string parameters: |
1147
|
|
|
|
|
|
|
C, |
1148
|
|
|
|
|
|
|
C, |
1149
|
|
|
|
|
|
|
C, |
1150
|
|
|
|
|
|
|
C, |
1151
|
|
|
|
|
|
|
C, |
1152
|
|
|
|
|
|
|
C, |
1153
|
|
|
|
|
|
|
C, |
1154
|
|
|
|
|
|
|
C, |
1155
|
|
|
|
|
|
|
C, |
1156
|
|
|
|
|
|
|
C, |
1157
|
|
|
|
|
|
|
C, |
1158
|
|
|
|
|
|
|
C, |
1159
|
|
|
|
|
|
|
C |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
=head2 C |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
$response = $e->render_search_template( |
1164
|
|
|
|
|
|
|
id => 'id', # optional |
1165
|
|
|
|
|
|
|
body => { template } # optional |
1166
|
|
|
|
|
|
|
); |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
Renders the template, filling in the passed-in parameters and returns the resulting JSON, eg: |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
$results = $e->render_search_template( |
1171
|
|
|
|
|
|
|
body => { |
1172
|
|
|
|
|
|
|
source => { |
1173
|
|
|
|
|
|
|
query => { |
1174
|
|
|
|
|
|
|
match => { |
1175
|
|
|
|
|
|
|
"{{my_field}}" => "{{my_value}}" |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
}, |
1178
|
|
|
|
|
|
|
size => "{{my_size}}" |
1179
|
|
|
|
|
|
|
}, |
1180
|
|
|
|
|
|
|
params => { |
1181
|
|
|
|
|
|
|
my_field => 'foo', |
1182
|
|
|
|
|
|
|
my_value => 'bar', |
1183
|
|
|
|
|
|
|
my_size => 6 |
1184
|
|
|
|
|
|
|
} |
1185
|
|
|
|
|
|
|
} |
1186
|
|
|
|
|
|
|
); |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
See the L |
1189
|
|
|
|
|
|
|
for more information. |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
=head2 C |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
$results = $e->scroll( |
1194
|
|
|
|
|
|
|
scroll => '1m', |
1195
|
|
|
|
|
|
|
body => { |
1196
|
|
|
|
|
|
|
scroll_id => $id |
1197
|
|
|
|
|
|
|
} |
1198
|
|
|
|
|
|
|
); |
1199
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
When a L has been performed with the |
1201
|
|
|
|
|
|
|
C parameter, the C |
1202
|
|
|
|
|
|
|
method allows you to keep pulling more results until the results |
1203
|
|
|
|
|
|
|
are exhausted. |
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
See L and L for a helper utility |
1206
|
|
|
|
|
|
|
which makes managing scroll requests much easier. |
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
Query string parameters: |
1209
|
|
|
|
|
|
|
C, |
1210
|
|
|
|
|
|
|
C, |
1211
|
|
|
|
|
|
|
C, |
1212
|
|
|
|
|
|
|
C, |
1213
|
|
|
|
|
|
|
C |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
See the L |
1216
|
|
|
|
|
|
|
and the L |
1217
|
|
|
|
|
|
|
for more information. |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
=head2 C |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
$response = $e->clear_scroll( |
1222
|
|
|
|
|
|
|
body => { |
1223
|
|
|
|
|
|
|
scroll_id => $id | \@ids # required |
1224
|
|
|
|
|
|
|
} |
1225
|
|
|
|
|
|
|
); |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
The C method can clear unfinished scroll requests, freeing |
1228
|
|
|
|
|
|
|
up resources on the server. |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
=head2 C |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
$scroll_helper = $e->scroll_helper( @args ); |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
Returns a new instance of the class specified in the L, |
1235
|
|
|
|
|
|
|
which defaults to L. |
1236
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
=head2 C |
1238
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
$results = $e->msearch( |
1240
|
|
|
|
|
|
|
index => 'default_index' | \@indices, # optional |
1241
|
|
|
|
|
|
|
type => 'default_type' | \@types, # optional |
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
body => [ searches ] # required |
1244
|
|
|
|
|
|
|
); |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
The C method allows you to perform multiple searches in a single |
1247
|
|
|
|
|
|
|
request. Similar to the L request, each search request in the |
1248
|
|
|
|
|
|
|
C consists of two hashes: the metadata hash then the search request |
1249
|
|
|
|
|
|
|
hash (the same data that you'd specify in the C of a L |
1250
|
|
|
|
|
|
|
request). For instance: |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
$results = $e->msearch( |
1253
|
|
|
|
|
|
|
index => 'default_index', |
1254
|
|
|
|
|
|
|
type => ['default_type_1', 'default_type_2'], |
1255
|
|
|
|
|
|
|
body => [ |
1256
|
|
|
|
|
|
|
# uses defaults |
1257
|
|
|
|
|
|
|
{}, |
1258
|
|
|
|
|
|
|
{ query => { match_all => {} }}, |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
# uses a custom index |
1261
|
|
|
|
|
|
|
{ index => 'not_the_default_index' }, |
1262
|
|
|
|
|
|
|
{ query => { match_all => {} }} |
1263
|
|
|
|
|
|
|
] |
1264
|
|
|
|
|
|
|
); |
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
Query string parameters: |
1267
|
|
|
|
|
|
|
C, |
1268
|
|
|
|
|
|
|
C, |
1269
|
|
|
|
|
|
|
C, |
1270
|
|
|
|
|
|
|
C, |
1271
|
|
|
|
|
|
|
C, |
1272
|
|
|
|
|
|
|
C, |
1273
|
|
|
|
|
|
|
C, |
1274
|
|
|
|
|
|
|
C |
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
See the L |
1277
|
|
|
|
|
|
|
for more information. |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
=head2 C |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
$results = $e->msearch_template( |
1282
|
|
|
|
|
|
|
index => 'default_index' | \@indices, # optional |
1283
|
|
|
|
|
|
|
type => 'default_type' | \@types, # optional |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
body => [ search_templates ] # required |
1286
|
|
|
|
|
|
|
); |
1287
|
|
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
The C method allows you to perform multiple searches in a single |
1289
|
|
|
|
|
|
|
request using search templates. Similar to the L request, each search |
1290
|
|
|
|
|
|
|
request in the C consists of two hashes: the metadata hash then the search request |
1291
|
|
|
|
|
|
|
hash (the same data that you'd specify in the C of a L |
1292
|
|
|
|
|
|
|
request). For instance: |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
$results = $e->msearch( |
1295
|
|
|
|
|
|
|
index => 'default_index', |
1296
|
|
|
|
|
|
|
type => ['default_type_1', 'default_type_2'], |
1297
|
|
|
|
|
|
|
body => [ |
1298
|
|
|
|
|
|
|
# uses defaults |
1299
|
|
|
|
|
|
|
{}, |
1300
|
|
|
|
|
|
|
{ source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }}, |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
# uses a custom index |
1303
|
|
|
|
|
|
|
{ index => 'not_the_default_index' }, |
1304
|
|
|
|
|
|
|
{ source => { query => { match => { user => "{{user}}" }}} params => { user => 'joe' }}, |
1305
|
|
|
|
|
|
|
] |
1306
|
|
|
|
|
|
|
); |
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
Query string parameters: |
1309
|
|
|
|
|
|
|
C, |
1310
|
|
|
|
|
|
|
C, |
1311
|
|
|
|
|
|
|
C, |
1312
|
|
|
|
|
|
|
C, |
1313
|
|
|
|
|
|
|
C, |
1314
|
|
|
|
|
|
|
C |
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
See the L |
1317
|
|
|
|
|
|
|
for more information. |
1318
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
=head2 C |
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
$response = $e->explain( |
1322
|
|
|
|
|
|
|
index => 'my_index', # required |
1323
|
|
|
|
|
|
|
type => 'my_type', # required |
1324
|
|
|
|
|
|
|
id => 123, # required |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
body => { search } # required |
1327
|
|
|
|
|
|
|
); |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
The C method explains why the specified document did or |
1330
|
|
|
|
|
|
|
did not match a query, and how the relevance score was calculated. |
1331
|
|
|
|
|
|
|
For instance: |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
$response = $e->explain( |
1334
|
|
|
|
|
|
|
index => 'my_index', |
1335
|
|
|
|
|
|
|
type => 'my_type', |
1336
|
|
|
|
|
|
|
id => 123, |
1337
|
|
|
|
|
|
|
body => { |
1338
|
|
|
|
|
|
|
query => { |
1339
|
|
|
|
|
|
|
match => { title => 'Elasticsearch clients' } |
1340
|
|
|
|
|
|
|
} |
1341
|
|
|
|
|
|
|
} |
1342
|
|
|
|
|
|
|
); |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
Query string parameters: |
1345
|
|
|
|
|
|
|
C<_source>, |
1346
|
|
|
|
|
|
|
C<_source_excludes>, |
1347
|
|
|
|
|
|
|
C<_source_includes>, |
1348
|
|
|
|
|
|
|
C, |
1349
|
|
|
|
|
|
|
C, |
1350
|
|
|
|
|
|
|
C, |
1351
|
|
|
|
|
|
|
C, |
1352
|
|
|
|
|
|
|
C, |
1353
|
|
|
|
|
|
|
C, |
1354
|
|
|
|
|
|
|
C, |
1355
|
|
|
|
|
|
|
C, |
1356
|
|
|
|
|
|
|
C, |
1357
|
|
|
|
|
|
|
C, |
1358
|
|
|
|
|
|
|
C, |
1359
|
|
|
|
|
|
|
C |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
See the L |
1362
|
|
|
|
|
|
|
for more information. |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
=head2 C |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
$response = $e->field_caps( |
1367
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1368
|
|
|
|
|
|
|
body => { filters } # optional |
1369
|
|
|
|
|
|
|
); |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
The C API returns field types and abilities, merged across indices. |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
Query string parameters: |
1374
|
|
|
|
|
|
|
C, |
1375
|
|
|
|
|
|
|
C, |
1376
|
|
|
|
|
|
|
C, |
1377
|
|
|
|
|
|
|
C, |
1378
|
|
|
|
|
|
|
C, |
1379
|
|
|
|
|
|
|
C |
1380
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
See the L |
1382
|
|
|
|
|
|
|
for more information. |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
=head2 C |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
$response = $e->search_shards( |
1387
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1388
|
|
|
|
|
|
|
) |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
The C method returns information about which shards on |
1391
|
|
|
|
|
|
|
which nodes will execute a search request. |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
Query string parameters: |
1394
|
|
|
|
|
|
|
C, |
1395
|
|
|
|
|
|
|
C, |
1396
|
|
|
|
|
|
|
C, |
1397
|
|
|
|
|
|
|
C, |
1398
|
|
|
|
|
|
|
C, |
1399
|
|
|
|
|
|
|
C, |
1400
|
|
|
|
|
|
|
C, |
1401
|
|
|
|
|
|
|
C |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
See the L |
1404
|
|
|
|
|
|
|
for more information. |
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
=head2 C |
1407
|
|
|
|
|
|
|
|
1408
|
|
|
|
|
|
|
$result = $e->rank_eval( |
1409
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1410
|
|
|
|
|
|
|
body => {...} # required |
1411
|
|
|
|
|
|
|
); |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
The ranking evaluation API provides a way to execute test cases to determine whether search results |
1414
|
|
|
|
|
|
|
are improving or worsening. |
1415
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
Query string parameters: |
1417
|
|
|
|
|
|
|
C, |
1418
|
|
|
|
|
|
|
C, |
1419
|
|
|
|
|
|
|
C, |
1420
|
|
|
|
|
|
|
C, |
1421
|
|
|
|
|
|
|
C, |
1422
|
|
|
|
|
|
|
C |
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
See the L |
1425
|
|
|
|
|
|
|
for more information. |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
=head1 CRUD-BY-QUERY METHODS |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=head2 C |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
$response = $e->delete_by_query( |
1432
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1433
|
|
|
|
|
|
|
type => 'type' | \@types, # optional, |
1434
|
|
|
|
|
|
|
body => { delete-by-query } # required |
1435
|
|
|
|
|
|
|
); |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
The C method deletes all documents which match the specified query. |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
Query string parameters: |
1440
|
|
|
|
|
|
|
C<_source>, |
1441
|
|
|
|
|
|
|
C<_source_excludes>, |
1442
|
|
|
|
|
|
|
C<_source_includes>, |
1443
|
|
|
|
|
|
|
C, |
1444
|
|
|
|
|
|
|
C, |
1445
|
|
|
|
|
|
|
C, |
1446
|
|
|
|
|
|
|
C, |
1447
|
|
|
|
|
|
|
C, |
1448
|
|
|
|
|
|
|
C, |
1449
|
|
|
|
|
|
|
C, |
1450
|
|
|
|
|
|
|
C, |
1451
|
|
|
|
|
|
|
C, |
1452
|
|
|
|
|
|
|
C, |
1453
|
|
|
|
|
|
|
C, |
1454
|
|
|
|
|
|
|
C, |
1455
|
|
|
|
|
|
|
C, |
1456
|
|
|
|
|
|
|
C, |
1457
|
|
|
|
|
|
|
C, |
1458
|
|
|
|
|
|
|
C, |
1459
|
|
|
|
|
|
|
C, |
1460
|
|
|
|
|
|
|
C, |
1461
|
|
|
|
|
|
|
C, |
1462
|
|
|
|
|
|
|
C, |
1463
|
|
|
|
|
|
|
C, |
1464
|
|
|
|
|
|
|
C, |
1465
|
|
|
|
|
|
|
C, |
1466
|
|
|
|
|
|
|
C, |
1467
|
|
|
|
|
|
|
C, |
1468
|
|
|
|
|
|
|
C, |
1469
|
|
|
|
|
|
|
C, |
1470
|
|
|
|
|
|
|
C, |
1471
|
|
|
|
|
|
|
C, |
1472
|
|
|
|
|
|
|
C, |
1473
|
|
|
|
|
|
|
C |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
See the L |
1476
|
|
|
|
|
|
|
for more information. |
1477
|
|
|
|
|
|
|
|
1478
|
|
|
|
|
|
|
=head2 C |
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
$response = $e->delete_by_query_rethrottle( |
1481
|
|
|
|
|
|
|
task_id => 'id' # required |
1482
|
|
|
|
|
|
|
requests_per_second => num |
1483
|
|
|
|
|
|
|
); |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
The C API is used to dynamically update the throtting |
1486
|
|
|
|
|
|
|
of an existing delete-by-query request, identified by C. |
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
Query string parameters: |
1489
|
|
|
|
|
|
|
C, |
1490
|
|
|
|
|
|
|
C, |
1491
|
|
|
|
|
|
|
C, |
1492
|
|
|
|
|
|
|
C |
1493
|
|
|
|
|
|
|
|
1494
|
|
|
|
|
|
|
See the L |
1495
|
|
|
|
|
|
|
for more information. |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
=head2 C |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
$response = $e->reindex( |
1500
|
|
|
|
|
|
|
body => { reindex } # required |
1501
|
|
|
|
|
|
|
); |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
The C API is used to index documents from one index or multiple indices |
1504
|
|
|
|
|
|
|
to a new index. |
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
Query string parameters: |
1507
|
|
|
|
|
|
|
C, |
1508
|
|
|
|
|
|
|
C, |
1509
|
|
|
|
|
|
|
C, |
1510
|
|
|
|
|
|
|
C, |
1511
|
|
|
|
|
|
|
C, |
1512
|
|
|
|
|
|
|
C, |
1513
|
|
|
|
|
|
|
C, |
1514
|
|
|
|
|
|
|
C |
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
See the L |
1517
|
|
|
|
|
|
|
for more information. |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
=head2 C |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
$response = $e->delete_by_query_rethrottle( |
1522
|
|
|
|
|
|
|
task_id => 'id', # required |
1523
|
|
|
|
|
|
|
requests_per_second => num |
1524
|
|
|
|
|
|
|
); |
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
The C API is used to dynamically update the throtting |
1527
|
|
|
|
|
|
|
of an existing reindex request, identified by C. |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
Query string parameters: |
1530
|
|
|
|
|
|
|
C, |
1531
|
|
|
|
|
|
|
C, |
1532
|
|
|
|
|
|
|
C, |
1533
|
|
|
|
|
|
|
C |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
See the L |
1536
|
|
|
|
|
|
|
for more information. |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
=head2 C |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
$response = $e->update_by_query( |
1541
|
|
|
|
|
|
|
index => 'index' | \@indices, # optional |
1542
|
|
|
|
|
|
|
type => 'type' | \@types, # optional, |
1543
|
|
|
|
|
|
|
body => { update-by-query } # optional |
1544
|
|
|
|
|
|
|
); |
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
The C API is used to bulk update documents from one index or |
1547
|
|
|
|
|
|
|
multiple indices using a script. |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
Query string parameters: |
1550
|
|
|
|
|
|
|
C<_source>, |
1551
|
|
|
|
|
|
|
C<_source_excludes>, |
1552
|
|
|
|
|
|
|
C<_source_includes>, |
1553
|
|
|
|
|
|
|
C, |
1554
|
|
|
|
|
|
|
C, |
1555
|
|
|
|
|
|
|
C, |
1556
|
|
|
|
|
|
|
C, |
1557
|
|
|
|
|
|
|
C, |
1558
|
|
|
|
|
|
|
C, |
1559
|
|
|
|
|
|
|
C, |
1560
|
|
|
|
|
|
|
C, |
1561
|
|
|
|
|
|
|
C, |
1562
|
|
|
|
|
|
|
C, |
1563
|
|
|
|
|
|
|
C, |
1564
|
|
|
|
|
|
|
C, |
1565
|
|
|
|
|
|
|
C, |
1566
|
|
|
|
|
|
|
C, |
1567
|
|
|
|
|
|
|
C, |
1568
|
|
|
|
|
|
|
C, |
1569
|
|
|
|
|
|
|
C, |
1570
|
|
|
|
|
|
|
C, |
1571
|
|
|
|
|
|
|
C, |
1572
|
|
|
|
|
|
|
C, |
1573
|
|
|
|
|
|
|
C, |
1574
|
|
|
|
|
|
|
C, |
1575
|
|
|
|
|
|
|
C, |
1576
|
|
|
|
|
|
|
C, |
1577
|
|
|
|
|
|
|
C, |
1578
|
|
|
|
|
|
|
C, |
1579
|
|
|
|
|
|
|
C, |
1580
|
|
|
|
|
|
|
C, |
1581
|
|
|
|
|
|
|
C, |
1582
|
|
|
|
|
|
|
C, |
1583
|
|
|
|
|
|
|
C, |
1584
|
|
|
|
|
|
|
C, |
1585
|
|
|
|
|
|
|
C |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
See the L |
1588
|
|
|
|
|
|
|
for more information. |
1589
|
|
|
|
|
|
|
|
1590
|
|
|
|
|
|
|
=head2 C |
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
$response = $e->update_by_query_rethrottle( |
1593
|
|
|
|
|
|
|
task_id => 'id' # required |
1594
|
|
|
|
|
|
|
requests_per_second => num |
1595
|
|
|
|
|
|
|
); |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
The C API is used to dynamically update the throtting |
1598
|
|
|
|
|
|
|
of an existing update-by-query request, identified by C. |
1599
|
|
|
|
|
|
|
|
1600
|
|
|
|
|
|
|
Query string parameters: |
1601
|
|
|
|
|
|
|
C, |
1602
|
|
|
|
|
|
|
C, |
1603
|
|
|
|
|
|
|
C, |
1604
|
|
|
|
|
|
|
C |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
See the L |
1607
|
|
|
|
|
|
|
for more information. |
1608
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
=head1 INDEXED SCRIPT METHODS |
1610
|
|
|
|
|
|
|
|
1611
|
|
|
|
|
|
|
Elasticsearch allows you to store scripts in the cluster state |
1612
|
|
|
|
|
|
|
and reference them by id. The methods to manage indexed scripts are as follows: |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
=head2 C |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
$result = $e->put_script( |
1617
|
|
|
|
|
|
|
id => 'id', # required |
1618
|
|
|
|
|
|
|
context => $context, # optional |
1619
|
|
|
|
|
|
|
body => { script } # required |
1620
|
|
|
|
|
|
|
); |
1621
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
The C method is used to store a script in the cluster state. For instance: |
1623
|
|
|
|
|
|
|
|
1624
|
|
|
|
|
|
|
$result = $e->put_scripts( |
1625
|
|
|
|
|
|
|
id => 'hello_world', |
1626
|
|
|
|
|
|
|
body => { |
1627
|
|
|
|
|
|
|
script => { |
1628
|
|
|
|
|
|
|
lang => 'painless', |
1629
|
|
|
|
|
|
|
source => q(return "hello world") |
1630
|
|
|
|
|
|
|
} |
1631
|
|
|
|
|
|
|
} |
1632
|
|
|
|
|
|
|
); |
1633
|
|
|
|
|
|
|
|
1634
|
|
|
|
|
|
|
Query string parameters: |
1635
|
|
|
|
|
|
|
C, |
1636
|
|
|
|
|
|
|
C |
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
See the L for more. |
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
=head2 C |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
$script = $e->get_script( |
1643
|
|
|
|
|
|
|
id => 'id', # required |
1644
|
|
|
|
|
|
|
); |
1645
|
|
|
|
|
|
|
|
1646
|
|
|
|
|
|
|
Retrieve the indexed script from the cluster state. |
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
Query string parameters: |
1649
|
|
|
|
|
|
|
C, |
1650
|
|
|
|
|
|
|
C, |
1651
|
|
|
|
|
|
|
C |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
See the L for more. |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
=head2 C |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
$script = $e->delete_script( |
1658
|
|
|
|
|
|
|
id => 'id', # required |
1659
|
|
|
|
|
|
|
); |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
Delete the indexed script from the cluster state. |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
Query string parameters: |
1664
|
|
|
|
|
|
|
C, |
1665
|
|
|
|
|
|
|
C, |
1666
|
|
|
|
|
|
|
C, |
1667
|
|
|
|
|
|
|
C |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
See the L for more. |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
=head2 C |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
$result = $e->scripts_painless_execute( |
1674
|
|
|
|
|
|
|
body => {...} # required |
1675
|
|
|
|
|
|
|
); |
1676
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
The Painless execute API allows an arbitrary script to be executed and a result to be returned. |
1678
|
|
|
|
|
|
|
|
1679
|
|
|
|
|
|
|
Query string parameters: |
1680
|
|
|
|
|
|
|
C, |
1681
|
|
|
|
|
|
|
C, |
1682
|
|
|
|
|
|
|
C |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
See the L for more. |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
=head1 AUTHOR |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
Enrico Zimuel |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Elasticsearch BV. |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
This is free software, licensed under: |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
1697
|
|
|
|
|
|
|
|
1698
|
|
|
|
|
|
|
=cut |
1699
|
|
|
|
|
|
|
|
1700
|
|
|
|
|
|
|
__END__ |