NAME

OpenSearch - A Perl client for OpenSearch (https://opensearch.org/)

SYNOPSIS

use strict;
use warnings;
use OpenSearch;

my $opensearch = OpenSearch->new(
  user => 'admin',
  pass => 'admin',
  hosts => ['http://localhost:9200'],
  secure => 0,
  allow_insecure => 1,
);

my $s = $self->search(
  index => 'my_index',
  query => {
    bool => {
      must => [ { range => { '@timestamp' => { gte => 'now-1d' } } } ],
    }
  }
);

# Blocking
my $response = $s->execute; 
# Non Blocking - Returns a Mojo::Promise;
my $promise = $s->execute_p->then(...)->catch(...);

# OR you can do it like this:
my $response = $s->search
  ->index('my_index')
  ->query({ 
    bool => { 
      must => [ { range => { '@timestamp' => { gte => 'now-1d' } } } ] 
    } 
  }
)->execute;

DESCRIPTION

This module is a Perl client for OpenSearch (https://opensearch.org/). It currently only supports a small subset of the OpenSearch API.

METHODS

cluster

returns a new OpenSearch::Cluster object

my $cluster = $opensearch->cluster;

cluster_allocation

returns a new OpenSearch::Cluster::Allocation object

my $cluster = $opensearch->cluster_allocation;

cluster_health

returns a new OpenSearch::Cluster::Health object

my $cluster = $opensearch->cluster_health;

cluster_settings

returns a new OpenSearch::Cluster::Settings object

my $cluster = $opensearch->cluster_settings;

cluster_stats

returns a new OpenSearch::Cluster::Stats object

my $cluster = $opensearch->cluster_stats;

remote

returns a new OpenSearch::Remote object

my $remote = $opensearch->remote;

remote_info

returns a new OpenSearch::Remote::Info object

my $remote = $opensearch->remote_info;

returns a new OpenSearch::Search object

my $search = $opensearch->search;

LICENSE

Copyright (C) localh0rst.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

localh0rst <git@fail.ninja>