NAME

OpenSearch::Document - OpenSearch Document API Endpoints

SYNOPSIS

use OpenSearch;

my $os = OpenSearch->new(...);
my $document = $os->document;

DESCRIPTION

This module provides an interface to the OpenSearch Document API endpoints.

METHODS

index

Index a single document.

my $res = $document->index(
  index => 'my_index',
  doc   => {
    user_agent => {
      name   => "Chrome",
      device => {
        name => "Other"
      }
    }
  } 
);

bulk

Index multiple documents. See the OpenSearch Bulk API documentation for more information.

my $res = $document->bulk(
  index => 'my_index',
  docs  => [
    {create => {}},
    {
      user_agent => {
        name   => "Chrome",
        device => {
          name => "Other"
        }
      }
    },
  ]
);


my $res = $document->bulk(
  { create => { _index => "movies", _id => "tt1392214" } }
  { title => Prisoners, year => 2013 }

);

get

Retrieve a single document.

my $res = $document->get(
  index => 'my_index',
  id    => 1337
);

AUTHOR

OpenSearch was written by Sebastian Grenz, <git at fail.ninja>