line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Store::ElasticSearch::Bag; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
11
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
623
|
use Catmandu::Hits; |
|
1
|
|
|
|
|
25001
|
|
|
1
|
|
|
|
|
37
|
|
8
|
1
|
|
|
1
|
|
9
|
use Cpanel::JSON::XS qw(encode_json decode_json); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
9
|
1
|
|
|
1
|
|
447
|
use Catmandu::Store::ElasticSearch::Searcher; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
1
|
|
480
|
use Catmandu::Store::ElasticSearch::CQL; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
36
|
|
11
|
1
|
|
|
1
|
|
7
|
use Catmandu::Util qw(is_code_ref is_string); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
12
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
13
|
1
|
|
|
1
|
|
326
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Catmandu::Bag'; |
16
|
|
|
|
|
|
|
with 'Catmandu::Droppable'; |
17
|
|
|
|
|
|
|
with 'Catmandu::Flushable'; |
18
|
|
|
|
|
|
|
with 'Catmandu::CQLSearchable'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has index => (is => 'lazy'); |
21
|
|
|
|
|
|
|
has settings => (is => 'lazy'); |
22
|
|
|
|
|
|
|
has mapping => (is => 'lazy'); |
23
|
|
|
|
|
|
|
has type => (is => 'lazy'); |
24
|
|
|
|
|
|
|
has buffer_size => (is => 'lazy', builder => 'default_buffer_size'); |
25
|
|
|
|
|
|
|
has _bulk => (is => 'lazy'); |
26
|
|
|
|
|
|
|
has cql_mapping => (is => 'ro'); |
27
|
|
|
|
|
|
|
has on_error => (is => 'lazy'); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub BUILD { |
30
|
0
|
|
|
0
|
0
|
|
$_[0]->create_index; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub create_index { |
34
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
35
|
0
|
|
|
|
|
|
my $es = $self->store->es; |
36
|
0
|
0
|
|
|
|
|
unless ($es->indices->exists(index => $self->index)) { |
37
|
0
|
|
|
|
|
|
$es->indices->create( |
38
|
|
|
|
|
|
|
index => $self->index, |
39
|
|
|
|
|
|
|
body => { |
40
|
|
|
|
|
|
|
settings => $self->settings, |
41
|
|
|
|
|
|
|
mappings => {$self->type => $self->mapping}, |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
0
|
|
sub default_buffer_size {100} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _coerce_on_error { |
51
|
0
|
|
|
0
|
|
|
my ($self, $cb) = @_; |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
if (is_code_ref($cb)) { |
54
|
0
|
|
|
|
|
|
return $cb; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
0
|
0
|
|
|
|
if (is_string($cb) && $cb eq 'throw') { |
57
|
|
|
|
|
|
|
return sub { |
58
|
0
|
|
|
0
|
|
|
my ($action, $res, $i) = @_; |
59
|
0
|
|
|
|
|
|
Catmandu::Error->throw(encode_json($res)); |
60
|
0
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
0
|
0
|
0
|
|
|
|
if (is_string($cb) && $cb eq 'log') { |
63
|
|
|
|
|
|
|
return sub { |
64
|
0
|
|
|
0
|
|
|
my ($action, $res, $i) = @_; |
65
|
0
|
|
|
|
|
|
$self->log->error(encode_json($res)); |
66
|
0
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
0
|
0
|
|
|
|
if (is_string($cb) && $cb eq 'ignore') { |
69
|
0
|
|
|
0
|
|
|
return sub { }; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Catmandu::BadArg->throw( |
73
|
0
|
|
|
|
|
|
"on_error should be code ref, 'throw', 'log', or 'ignore'"); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _build_on_error { |
77
|
0
|
|
|
0
|
|
|
'log'; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _build_settings { |
81
|
0
|
|
|
0
|
|
|
+{}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _build_mapping { |
85
|
0
|
|
|
0
|
|
|
+{}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _build_index { |
89
|
0
|
|
|
0
|
|
|
$_[0]->name; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _build_type { |
93
|
0
|
|
|
0
|
|
|
$_[0]->name; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _build__bulk { |
97
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
98
|
0
|
|
|
|
|
|
my $on_error = $self->_coerce_on_error($self->on_error); |
99
|
0
|
|
|
|
|
|
my %args = ( |
100
|
|
|
|
|
|
|
index => $self->index, |
101
|
|
|
|
|
|
|
type => $self->type, |
102
|
|
|
|
|
|
|
max_count => $self->buffer_size, |
103
|
|
|
|
|
|
|
on_error => $on_error, |
104
|
|
|
|
|
|
|
); |
105
|
0
|
0
|
|
|
|
|
if ($self->log->is_debug) { |
106
|
|
|
|
|
|
|
$args{on_success} = sub { |
107
|
0
|
|
|
0
|
|
|
my ($action, $res, $i) = @_; |
108
|
0
|
|
|
|
|
|
$self->log->debug(encode_json($res)); |
109
|
0
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
} |
111
|
0
|
|
|
|
|
|
$self->store->es->bulk_helper(%args); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub generator { |
115
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
116
|
0
|
|
|
|
|
|
my $id_key = $self->id_key; |
117
|
|
|
|
|
|
|
sub { |
118
|
0
|
|
|
0
|
|
|
state $scroll = do { |
119
|
0
|
|
|
|
|
|
my %args = ( |
120
|
|
|
|
|
|
|
index => $self->index, |
121
|
|
|
|
|
|
|
type => $self->type, |
122
|
|
|
|
|
|
|
size => $self->buffer_size, # TODO divide by number of shards |
123
|
|
|
|
|
|
|
body => {query => {match_all => {}},}, |
124
|
|
|
|
|
|
|
); |
125
|
0
|
0
|
|
|
|
|
if ($self->store->is_es_1_or_2) { |
126
|
0
|
|
|
|
|
|
$args{search_type} = 'scan'; |
127
|
|
|
|
|
|
|
} |
128
|
0
|
|
|
|
|
|
$self->store->es->scroll_helper(%args); |
129
|
|
|
|
|
|
|
}; |
130
|
0
|
|
0
|
|
|
|
my $doc = $scroll->next // do { |
131
|
0
|
|
|
|
|
|
$scroll->finish; |
132
|
0
|
|
|
|
|
|
return; |
133
|
|
|
|
|
|
|
}; |
134
|
0
|
|
|
|
|
|
my $data = $doc->{_source}; |
135
|
0
|
|
|
|
|
|
$data->{$id_key} = $doc->{_id}; |
136
|
0
|
|
|
|
|
|
$data; |
137
|
0
|
|
|
|
|
|
}; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub count { |
141
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
142
|
|
|
|
|
|
|
$self->store->es->count(index => $self->index, type => $self->type,) |
143
|
0
|
|
|
|
|
|
->{count}; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub get { |
147
|
|
|
|
|
|
|
my ($self, $id) = @_; |
148
|
|
|
|
|
|
|
try { |
149
|
|
|
|
|
|
|
my $data = $self->store->es->get_source( |
150
|
|
|
|
|
|
|
index => $self->index, |
151
|
|
|
|
|
|
|
type => $self->type, |
152
|
|
|
|
|
|
|
id => $id, |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
$data->{$self->id_key} = $id; |
155
|
|
|
|
|
|
|
$data; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
catch_case ['Search::Elasticsearch::Error::Missing' => sub {undef}]; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub add { |
161
|
|
|
|
|
|
|
my ($self, $data) = @_; |
162
|
|
|
|
|
|
|
$data = {%$data}; |
163
|
|
|
|
|
|
|
my $id = delete($data->{$self->id_key}); |
164
|
|
|
|
|
|
|
$self->_bulk->index({id => $id, source => $data,}); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub delete { |
168
|
|
|
|
|
|
|
my ($self, $id) = @_; |
169
|
|
|
|
|
|
|
$self->_bulk->delete({id => $id}); |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub delete_all { |
173
|
|
|
|
|
|
|
my ($self) = @_; |
174
|
|
|
|
|
|
|
my $es = $self->store->es; |
175
|
|
|
|
|
|
|
if ($es->can('delete_by_query')) { |
176
|
|
|
|
|
|
|
$es->delete_by_query( |
177
|
|
|
|
|
|
|
index => $self->index, |
178
|
|
|
|
|
|
|
type => $self->type, |
179
|
|
|
|
|
|
|
body => {query => {match_all => {}},}, |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
else { # TODO document plugin needed for es 2.x |
183
|
|
|
|
|
|
|
$es->transport->perform_request( |
184
|
|
|
|
|
|
|
method => 'DELETE', |
185
|
|
|
|
|
|
|
path => '/' . $self->index . '/' . $self->type . '/_query', |
186
|
|
|
|
|
|
|
body => {query => {match_all => {}},} |
187
|
|
|
|
|
|
|
); |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub delete_by_query { |
192
|
|
|
|
|
|
|
my ($self, %args) = @_; |
193
|
|
|
|
|
|
|
my $es = $self->store->es; |
194
|
|
|
|
|
|
|
if ($es->can('delete_by_query')) { |
195
|
|
|
|
|
|
|
$es->delete_by_query( |
196
|
|
|
|
|
|
|
index => $self->index, |
197
|
|
|
|
|
|
|
type => $self->type, |
198
|
|
|
|
|
|
|
body => {query => $args{query},}, |
199
|
|
|
|
|
|
|
); |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
else { # TODO document plugin needed for es 2.x |
202
|
|
|
|
|
|
|
$es->transport->perform_request( |
203
|
|
|
|
|
|
|
method => 'DELETE', |
204
|
|
|
|
|
|
|
path => '/' . $self->index . '/' . $self->type . '/_query', |
205
|
|
|
|
|
|
|
body => {query => $args{query},} |
206
|
|
|
|
|
|
|
); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub flush { |
211
|
0
|
|
|
0
|
0
|
|
$_[0]->_bulk->flush; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
sub commit { |
215
|
|
|
|
|
|
|
my ($self) = @_; |
216
|
|
|
|
|
|
|
$self->store->es->transport->perform_request( |
217
|
|
|
|
|
|
|
method => 'POST', |
218
|
|
|
|
|
|
|
path => '/' . $self->index . '/_refresh', |
219
|
|
|
|
|
|
|
); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub search { |
223
|
|
|
|
|
|
|
my ($self, %args) = @_; |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
my $id_key = $self->id_key; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $start = delete $args{start}; |
228
|
|
|
|
|
|
|
my $limit = delete $args{limit}; |
229
|
|
|
|
|
|
|
my $bag = delete $args{reify}; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
if ($bag) { |
232
|
|
|
|
|
|
|
$args{fields} = []; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my $res = $self->store->es->search( |
236
|
|
|
|
|
|
|
index => $self->index, |
237
|
|
|
|
|
|
|
type => $self->type, |
238
|
|
|
|
|
|
|
body => {%args, from => $start, size => $limit,}, |
239
|
|
|
|
|
|
|
); |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
my $docs = $res->{hits}{hits}; |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my $hits |
244
|
|
|
|
|
|
|
= {start => $start, limit => $limit, total => $res->{hits}{total},}; |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
if ($bag) { |
247
|
|
|
|
|
|
|
$hits->{hits} = [map {$bag->get($_->{_id})} @$docs]; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
elsif ($args{fields}) { |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# TODO check if fields includes id_key |
252
|
|
|
|
|
|
|
$hits->{hits} = [map {$_->{fields} || +{}} @$docs]; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
else { |
255
|
|
|
|
|
|
|
$hits->{hits} = [ |
256
|
|
|
|
|
|
|
map { |
257
|
|
|
|
|
|
|
my $data = $_->{_source}; |
258
|
|
|
|
|
|
|
$data->{$id_key} = $_->{_id}; |
259
|
|
|
|
|
|
|
$data; |
260
|
|
|
|
|
|
|
} @$docs |
261
|
|
|
|
|
|
|
]; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
$hits = Catmandu::Hits->new($hits); |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
for my $key (qw(facets suggest aggregations)) { |
267
|
|
|
|
|
|
|
$hits->{$key} = $res->{$key} if exists $res->{$key}; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
if ($args{highlight}) { |
271
|
|
|
|
|
|
|
for my $hit (@$docs) { |
272
|
|
|
|
|
|
|
if (my $hl = $hit->{highlight}) { |
273
|
|
|
|
|
|
|
$hits->{highlight}{$hit->{$id_key}} = $hl; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
$hits; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub searcher { |
282
|
|
|
|
|
|
|
my ($self, %args) = @_; |
283
|
|
|
|
|
|
|
Catmandu::Store::ElasticSearch::Searcher->new(%args, bag => $self); |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub translate_sru_sortkeys { |
287
|
0
|
|
|
0
|
0
|
|
my ($self, $sortkeys) = @_; |
288
|
|
|
|
|
|
|
[ |
289
|
0
|
|
|
|
|
|
grep {defined $_} map {$self->_translate_sru_sortkey($_)} split /\s+/, |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
$sortkeys |
291
|
|
|
|
|
|
|
]; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub _translate_sru_sortkey { |
295
|
0
|
|
|
0
|
|
|
my ($self, $sortkey) = @_; |
296
|
0
|
|
|
|
|
|
my ($field, $schema, $asc) = split /,/, $sortkey; |
297
|
0
|
0
|
|
|
|
|
$field || return; |
298
|
0
|
0
|
|
|
|
|
if (my $map = $self->cql_mapping) { |
299
|
0
|
|
|
|
|
|
$field = lc $field; |
300
|
|
|
|
|
|
|
$field =~ s/(?<=[^_])_(?=[^_])//g |
301
|
0
|
0
|
|
|
|
|
if $map->{strip_separating_underscores}; |
302
|
0
|
|
0
|
|
|
|
$map = $map->{indexes} || return; |
303
|
0
|
|
0
|
|
|
|
$map = $map->{$field} || return; |
304
|
0
|
0
|
|
|
|
|
$map->{sort} || return; |
305
|
0
|
0
|
0
|
|
|
|
if (ref $map->{sort} && $map->{sort}{field}) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
306
|
0
|
|
|
|
|
|
$field = $map->{sort}{field}; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
elsif (ref $map->{field}) { |
309
|
0
|
|
|
|
|
|
$field = $map->{field}->[0]; |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
elsif ($map->{field}) { |
312
|
0
|
|
|
|
|
|
$field = $map->{field}; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
} |
315
|
0
|
|
0
|
|
|
|
$asc //= 1; |
316
|
0
|
0
|
|
|
|
|
+{$field => $asc ? 'asc' : 'desc'}; |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub translate_cql_query { |
320
|
0
|
|
|
0
|
0
|
|
my ($self, $query) = @_; |
321
|
0
|
|
|
|
|
|
Catmandu::Store::ElasticSearch::CQL->new( |
322
|
|
|
|
|
|
|
mapping => $self->cql_mapping, |
323
|
|
|
|
|
|
|
id_key => $self->id_key |
324
|
|
|
|
|
|
|
)->parse($query); |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
sub normalize_query { |
328
|
0
|
|
|
0
|
0
|
|
my ($self, $query) = @_; |
329
|
0
|
0
|
|
|
|
|
if (ref $query) { |
|
|
0
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
$query; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
elsif ($query) { |
333
|
0
|
|
|
|
|
|
{query_string => {query => $query}}; |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
else { |
336
|
0
|
|
|
|
|
|
{match_all => {}}; |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
# assume a sort string is JSON encoded |
341
|
|
|
|
|
|
|
sub normalize_sort { |
342
|
0
|
|
|
0
|
0
|
|
my ($self, $sort) = @_; |
343
|
0
|
0
|
|
|
|
|
return $sort if ref $sort; |
344
|
0
|
0
|
|
|
|
|
return if !$sort; |
345
|
0
|
|
|
|
|
|
decode_json($sort); |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub drop { |
349
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
350
|
0
|
|
|
|
|
|
$self->store->es->indices->delete(index => $self->index); |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
1; |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
__END__ |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=pod |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=head1 NAME |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
Catmandu::Store::ElasticSearch::Bag - Catmandu::Bag implementation for Elasticsearch |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head1 DESCRIPTION |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
See the main documentation at L<Catmandu::Store::ElasticSearch>. |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=head1 METHODS |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
This class inherits all the methods of L<Catmandu::Bag>, |
370
|
|
|
|
|
|
|
L<Catmandu::CQLSearchable> and L<Catmandu::Droppable>. |
371
|
|
|
|
|
|
|
It also provides the following methods: |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=head2 create_index() |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
This method is called automatically when the bag is instantiated. You only need |
376
|
|
|
|
|
|
|
to call it manually it after deleting the index with C<drop> or the |
377
|
|
|
|
|
|
|
Elasticsearch API. |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head1 SEE ALSO |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
L<Catmandu::Bag>, L<Catmandu::Searchable>, L<Catmandu::CQLSearchable>, L<Catmandu::Droppable> |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=cut |