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