← Index
NYTProf Performance Profile   « line view »
For flows_to_es.pl
  Run on Mon May 9 23:27:59 2016
Reported on Mon May 9 23:28:09 2016

Filename/opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/QS.pm
StatementsExecuted 2502 statements in 2.53ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11411913µs913µsSearch::Elasticsearch::Util::API::QS::::qs_initSearch::Elasticsearch::Util::API::QS::qs_init
11116µs30µsSearch::Elasticsearch::Util::API::QS::::BEGIN@3Search::Elasticsearch::Util::API::QS::BEGIN@3
11113µs299µsSearch::Elasticsearch::Util::API::QS::::BEGIN@6Search::Elasticsearch::Util::API::QS::BEGIN@6
11111µs24µsSearch::Elasticsearch::Util::API::QS::::BEGIN@283Search::Elasticsearch::Util::API::QS::BEGIN@283
11110µs15µsSearch::Elasticsearch::Util::API::QS::::BEGIN@4Search::Elasticsearch::Util::API::QS::BEGIN@4
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:14]Search::Elasticsearch::Util::API::QS::__ANON__[:14]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:15]Search::Elasticsearch::Util::API::QS::__ANON__[:15]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:20]Search::Elasticsearch::Util::API::QS::__ANON__[:20]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:21]Search::Elasticsearch::Util::API::QS::__ANON__[:21]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:22]Search::Elasticsearch::Util::API::QS::__ANON__[:22]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:23]Search::Elasticsearch::Util::API::QS::__ANON__[:23]
0000s0sSearch::Elasticsearch::Util::API::QS::::__ANON__[:9]Search::Elasticsearch::Util::API::QS::__ANON__[:9]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Search::Elasticsearch::Util::API::QS;
211µs$Search::Elasticsearch::Util::API::QS::VERSION = '2.02';
3236µs244µs
# spent 30µs (16+14) within Search::Elasticsearch::Util::API::QS::BEGIN@3 which was called: # once (16µs+14µs) by Search::Elasticsearch::Role::API::2_0::BEGIN@6 at line 3
use strict;
# spent 30µs making 1 call to Search::Elasticsearch::Util::API::QS::BEGIN@3 # spent 14µs making 1 call to strict::import
4238µs220µs
# spent 15µs (10+5) within Search::Elasticsearch::Util::API::QS::BEGIN@4 which was called: # once (10µs+5µs) by Search::Elasticsearch::Role::API::2_0::BEGIN@6 at line 4
use warnings;
# spent 15µs making 1 call to Search::Elasticsearch::Util::API::QS::BEGIN@4 # spent 5µs making 1 call to warnings::import
5
62936µs2585µs
# spent 299µs (13+286) within Search::Elasticsearch::Util::API::QS::BEGIN@6 which was called: # once (13µs+286µs) by Search::Elasticsearch::Role::API::2_0::BEGIN@6 at line 6
use Sub::Exporter -setup => { exports => ['qs_init'] };
7
8our %Handler = (
9 string => sub {"$_[0]"},
10 list => sub {
11 ref $_[0] eq 'ARRAY'
12 ? join( ',', @{ shift() } )
13 : shift();
14 },
15 bool => sub { $_[0] ? 1 : 0 },
16 enum => sub {
17 ref $_[0] eq 'ARRAY'
18 ? join( ',', @{ shift() } )
19 : shift();
20 },
21 number => sub { 0 + $_[0] },
22 datetime => sub {"$_[0]"},
23 duration => sub {"$_[0]"},
24112µs);
25
261169µsour %Params = (
27 actions => { type => 'list' },
28 active => { type => 'bool' },
29 active_only => { type => 'bool' },
30 all => { type => 'bool' },
31 allow_no_indices => { type => 'bool' },
32 analyze_wildcard => { type => 'bool' },
33 analyzer => { type => 'string' },
34 attributes => { type => 'list' },
35 boost_terms => { type => 'number' },
36 bytes => { type => 'enum', options => [ 'b', 'k', 'm', 'g' ] },
37 char_filters => { type => 'list' },
38 clear => { type => 'bool' },
39 completion => { type => 'bool' },
40 completion_fields => { type => 'list' },
41 conflicts => {
42 type => 'enum',
43 options => [ 'abort', 'proceed' ],
44 default => 'abort'
45 },
46 consistency => {
47 options => [ 'one', 'quorum', 'all' ],
48 type => 'enum'
49 },
50 create => { type => 'bool' },
51 debug => { type => 'bool' },
52 default_operator => {
53 default => 'OR',
54 options => [ 'AND', 'OR' ],
55 type => 'enum'
56 },
57 delay => { type => 'duration' },
58 detail => { type => 'bool' },
59 detailed => { type => 'bool' },
60 detect_noop => { type => 'bool' },
61 df => { type => 'string' },
62 dfs => { type => 'bool' },
63 docs => { type => 'bool' },
64 dry_run => { type => 'bool' },
65 exit => { type => 'bool' },
66 expand_wildcards => {
67 type => 'enum',
68 options => [ 'open', 'closed', 'none', 'all' ]
69 },
70 explain => { type => 'bool' },
71 field => { type => 'string' },
72 field_statistics => { type => 'bool' },
73 fielddata => { type => 'bool' },
74 fielddata_fields => { type => 'list' },
75 fields => { type => 'list' },
76 filter => { type => 'bool' },
77 filter_blocks => { type => 'bool' },
78 filter_cache => { type => 'bool' },
79 filter_index_templates => { type => 'bool' },
80 filter_indices => { type => 'list' },
81 filter_keys => { type => 'bool' },
82 filter_path => { type => 'list' },
83 filter_metadata => { type => 'bool' },
84 filter_nodes => { type => 'bool' },
85 filter_routing_table => { type => 'bool' },
86 filters => { type => 'list' },
87 flat_settings => { type => 'bool' },
88 flush => { type => 'bool' },
89 force => { type => 'bool' },
90 format => {
91 default => 'detailed',
92 options => [ 'detailed', 'text' ],
93 type => 'enum'
94 },
95 from => { type => 'number' },
96 fs => { type => 'bool' },
97 full => { type => 'bool' },
98 full_id => { type => 'bool' },
99 get => { type => 'bool' },
100 groups => { type => 'list' },
101 http => { type => 'bool' },
102 h => { type => 'list' },
103 help => { type => 'bool' },
104 human => { type => 'bool' },
105 id => { type => 'string' },
106 id_cache => { type => 'bool' },
107 ids => { type => 'list' },
108 ignore_conflicts => { type => 'bool' },
109 ignore_indices => {
110 default => 'none',
111 options => [ 'none', 'missing' ],
112 type => 'enum'
113 },
114 ignore => { type => 'list', },
115 ignore_idle_threads => { type => 'bool' },
116 ignore_unavailable => { type => 'bool' },
117 include_defaults => { type => 'bool' },
118 index => { type => 'list' },
119 index_templates => { type => 'list' },
120 indexing => { type => 'bool' },
121 indices => { type => 'bool' },
122 interval => { type => 'duration' },
123 jvm => { type => 'bool' },
124 lang => { type => 'string' },
125 lenient => { type => 'bool' },
126 level => {
127 options => [ 'cluster', 'node', 'indices', 'shards' ],
128 type => 'enum'
129 },
130 local => { type => 'bool' },
131 lowercase_expanded_terms => { type => 'bool' },
132 master_timeout => { type => 'duration' },
133 max_doc_freq => { type => 'number' },
134 max_num_segments => { type => 'number' },
135 max_query_terms => { type => 'number' },
136 max_word_len => { type => 'number' }, # depr 0.90
137 max_word_length => { type => 'number' },
138 metric => {
139 type => 'enum',
140 options => [
141 "_all", "blocks", "metadata", "nodes",
142 "routing_table", "master_node", "version"
143 ]
144 },
145 merge => { type => 'bool' },
146 min_doc_freq => { type => 'number' },
147 min_score => { type => 'number' },
148 min_term_freq => { type => 'number' },
149 min_word_len => { type => 'number' }, # depr 0.90
150 min_word_length => { type => 'number' },
151 mlt_fields => { type => 'list' },
152 name => { type => 'list' },
153 network => { type => 'bool' },
154 node_id => { type => 'list' },
155 offsets => { type => 'bool' },
156 only_ancient_segments => { type => 'bool' },
157 only_expunge_deletes => { type => 'bool' },
158 op_type => {
159 default => 'index',
160 options => [ 'index', 'create' ],
161 type => 'enum'
162 },
163 order => { type => 'number' },
164 os => { type => 'bool' },
165 parent => { type => 'string' },
166 parent_node => { type => 'string' },
167 parent_task => { type => 'string' },
168 payloads => { type => 'bool' },
169 percent_terms_to_match => { type => 'number' },
170 percolate => { type => 'string' },
171 percolate_format => { type => 'string' },
172 percolate_index => { type => 'string' },
173 percolate_preference => { type => 'string' },
174 percolate_routing => { type => 'list' },
175 percolate_type => { type => 'string' },
176 pipeline => { type => 'string' },
177 plugin => { type => 'bool' },
178 positions => { type => 'bool' },
179 prefer_local => { type => 'bool' },
180 preference => { type => 'string' },
181 pri => { type => 'bool' },
182 process => { type => 'bool' },
183 q => { type => 'string' },
184 query => { type => 'bool' },
185 query_cache => { type => 'bool' },
186 realtime => { type => 'bool' },
187 recovery => { type => 'bool' },
188 recycler => { type => 'bool' },
189 refresh => { type => 'bool' },
190 replication => {
191 default => 'sync',
192 options => [ 'sync', 'async' ],
193 type => 'enum'
194 },
195 request => { type => 'bool' },
196 request_cache => { type => 'bool' },
197 retry_on_conflict => { type => 'number' },
198 rewrite => { type => 'bool' },
199 routing => { type => 'string' },
200 script => { type => 'string' },
201 script_id => { type => 'string' },
202 scripted_upsert => { type => 'bool' },
203 scroll => { type => 'duration' },
204 scroll_id => { type => 'string' },
205 scroll_size => { type => 'number' },
206 search => { type => 'bool' },
207 search_from => { type => 'number' },
208 search_indices => { type => 'list' },
209 search_scroll => { type => 'string' },
210 search_size => { type => 'number' },
211 search_source => { type => 'string' },
212 search_timeout => { type => 'duration' },
213 search_type => {
214 options => [
215 'query_then_fetch', 'query_and_fetch',
216 'dfs_query_then_fetch', 'dfs_query_and_fetch',
217 'count', 'scan'
218 ],
219 type => 'enum'
220 },
221 search_types => { type => 'list' },
222 settings => { type => 'bool' },
223 size => { type => 'number' },
224 snapshot => { type => 'bool' },
225 snapshots => { type => 'number' },
226 sort => { type => 'list' },
227 source => { type => 'string' },
228 _source => { type => 'list', },
229 _source_exclude => { type => 'list', },
230 _source_include => { type => 'list', },
231 stats => { type => 'list' },
232 status => { type => 'string' },
233 stop_words => { type => 'list' },
234 store => { type => 'bool' },
235 suggest_field => { type => 'string' },
236 suggest_mode => {
237 default => 'missing',
238 options => [ 'missing', 'popular', 'always' ],
239 type => 'enum'
240 },
241 suggest_size => { type => 'number' },
242 suggest_text => { type => 'string' },
243 term_statistics => { type => 'bool' },
244 terminate_after => { type => 'number' },
245 text => { type => 'string' },
246 thread_pool => { type => 'bool' },
247 threads => { type => 'number' },
248 timeout => { type => 'duration' },
249 timestamp => { type => 'datetime' },
250 tokenizer => { type => 'string' },
251 track_scores => { type => 'bool' },
252 transport => { type => 'bool' },
253 ts => { type => 'bool' },
254 ttl => { type => 'duration' },
255 type => { type => 'string' },
256 types => { type => 'list' },
257 update_all_types => { type => 'bool' },
258 v => { type => 'bool' },
259 verbose => { type => 'bool' },
260 verify => { type => 'bool' },
261 version => { type => 'number' },
262 version_type => {
263 type => 'enum',
264 options => [ 'internal', 'external' ]
265 },
266 wait_for_active_shards => { type => 'number' },
267 wait_for_completion => { type => 'bool' },
268 wait_for_merge => { type => 'bool' },
269 wait_for_nodes => { type => 'string' },
270 wait_for_relocating_shards => { type => 'number' },
271 wait_for_status => {
272 default => undef,
273 options => [ 'green', 'yellow', 'red' ],
274 type => 'enum'
275 },
276 wait_if_ongoing => { type => 'bool' },
277 warmer => { type => 'bool' }
278);
279
280#===================================
281
# spent 913µs within Search::Elasticsearch::Util::API::QS::qs_init which was called 114 times, avg 8µs/call: # 114 times (913µs+0s) by Module::Runtime::require_module at line 1684 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/API/2_0.pm, avg 8µs/call
sub qs_init {
282#===================================
2832224µs236µs
# spent 24µs (11+12) within Search::Elasticsearch::Util::API::QS::BEGIN@283 which was called: # once (11µs+12µs) by Search::Elasticsearch::Role::API::2_0::BEGIN@6 at line 283
no warnings 'uninitialized';
# spent 24µs making 1 call to Search::Elasticsearch::Util::API::QS::BEGIN@283 # spent 12µs making 1 call to warnings::unimport
28411412µs my %qs;
28511454µs for (@_) {
286716208µs my $defn = $Params{$_} || die("Unknown query-string param ($_)\n");
287716173µs $defn->{handler} ||= $Handler{ $defn->{type} }
288 || die "Unknown query-string parameter type ($defn->{type})\n";
289716371µs $qs{$_} = $defn;
290 }
291114230µs return \%qs;
292}
293
294165µs1;
295
296=pod
297
298=encoding UTF-8
299
300=head1 NAME
301
302Search::Elasticsearch::Util::API::QS - A utility class for query string parameters in the API
303
304=head1 VERSION
305
306version 2.02
307
308=head1 DESCRIPTION
309
310This class contains a definition of each query string parameter that
311can be accepted by actions in the L<API|Search::Elasticsearch::Role::API>.
312
313=head1 EXPORTS
314
315=head2 C<qs_init()>
316
317 use Search::Elasticsearch::Util::API::QS qw(qs_init);
318 $handler = qs_init( @qs_params );
319 $qs_hash = $handler->($params);
320
321The C<qs_init()> sub accepts a list of query string parameter names,
322and returns a handler which can extract those parameters from C<\%params>
323and return a hash of values to be passed as a query string.
324
325For instance:
326
327 $handler = qs_init(qw(fields size from));
328 $params = { fields =>['foo','bar'], size => 10, query=>\%query };
329 $qs_hash = $handler->($params);
330
331Would result in:
332
333 $qs_hash: { fields => 'foo,bar', size => 10};
334 $params: { query => \%query }
335
336=head1 AUTHOR
337
338Clinton Gormley <drtech@cpan.org>
339
340=head1 COPYRIGHT AND LICENSE
341
342This software is Copyright (c) 2016 by Elasticsearch BV.
343
344This is free software, licensed under:
345
346 The Apache License, Version 2.0, January 2004
347
348=cut
349
350__END__