App-ElasticSearch-Utilities
view release on metacpan or search on metacpan
README.mkdn view on Meta::CPAN
Grab the value of the global value from the es-utils.yaml files.
## es\_basic\_auth($host)
Get the user/password combination for this host. This is called from LWP::UserAgent if
it recieves a 401, so the auth condition must be satisfied.
Returns the username and password as a list.
## es\_pass\_exec(host, username)
Called from es\_basic\_auth to exec a program, capture the password
and return it to the caller. This allows the use of password vaults
and keychains.
## es\_pattern
Returns a hashref of the pattern filter used to get the indexes
{
string => '\*',
re => '.\*',
}
## es\_connect
Without options, this connects to the server defined in the args. If passed
an array ref, it will use that as the connection definition.
## es\_master(\[$handle\])
Returns true (1) if the handle is to the the cluster master, or false (0) otherwise.
## es\_request(\[$handle\],$command,{ method => 'GET', uri\_param => { a => 1 } }, {})
Retrieve URL from ElasticSearch, returns a hash reference
First hash ref contains options, including:
uri_param Query String Parameters
index Index name
type Index type
method Default is GET
If the request is not successful, this function will throw a fatal exception.
If you'd like to proceed you need to catch that error.
## es\_nodes
Returns the hash of index meta data.
## es\_indices\_meta
Returns the hash of index meta data.
## es\_indices
Returns a list of active indexes matching the filter criteria specified on the command
line. Can handle indices named:
logstash-YYYY.MM.DD
dcid-logstash-YYYY.MM.DD
logstash-dcid-YYYY.MM.DD
logstash-YYYY.MM.DD-dcid
Makes use of --datesep to determine where the date is.
Options include:
- **state**
Default is 'open', can be used to find 'closed' indexes as well.
- **check\_state**
Default is 1, set to 0 to disable state checks. The combination of the default
with this option and the default for **state** means only open indices are returned.
- **check\_dates**
Default is 1, set to 0 to disable checking index age.
## es\_index\_strip\_date( 'index-name' )
Returns the index name with the date removed.
## es\_index\_bases( 'index-name' )
Returns an array of the possible index base names for this index
## es\_index\_days\_old( 'index-name' )
Return the number of days old this index is.
## es\_index\_shards( 'index-name' )
Returns the number of replicas for a given index.
## es\_index\_valid( 'index-name' )
Checks if the specified index is valid
## es\_index\_fields('index-name')
Returns a hash reference with the following data:
key_name:
type: field_data_type
# If the field is nested
nested_path: nested_path
nested_key: nested_key
## es\_close\_index('index-name')
Closes an index
## es\_open\_index('index-name')
Open an index
## es\_delete\_index('index-name')
Deletes an index
( run in 2.852 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )