Scroll to navigation

Search::Elasticsearch::Client::2_0::Role::API(3pm) User Contributed Perl Documentation Search::Elasticsearch::Client::2_0::Role::API(3pm)

NAME

Search::Elasticsearch::Client::2_0::Role::API - This class contains the spec for the Elasticsearch APIs

VERSION

version 5.02

DESCRIPTION

All of the Elasticsearch APIs are defined in this role. The example given below is the definition for the "index()" in Search::Elasticsearch::Client::2_0::Direct method:

    'index' => {
        body   => { required => 1 },
        doc    => "docs-index_",
        method => "POST",
        parts  => {
            id    => {},
            index => { required => 1 },
            type  => { required => 1 }
        },
        paths => [
            [   { id => 2, index => 0, type => 1 }, "{index}",
                "{type}", "{id}"
            ],
            [ { index => 0, type => 1 }, "{index}", "{type}" ],
        ],
        qs => {
            consistency  => "enum",
            filter_path  => "list",
            op_type      => "enum",
            parent       => "string",
            refresh      => "boolean",
            routing      => "string",
            timeout      => "time",
            timestamp    => "time",
            ttl          => "time",
            version      => "number",
            version_type => "enum",
        },
    },

These definitions can be used by different Search::Elasticsearch::Role::Client implementations to provide distinct user interfaces.

METHODS

"api()"

    $defn = $api->api($name);

The only method in this class is the "api()" method which takes the name of the action and returns its definition. Actions in the "indices" or "cluster" namespace use the namespace as a prefix, eg:

    $defn = $e->api('indices.create');
    $defn = $e->api('cluster.node_stats');

SEE ALSO

  • Search::Elasticsearch::Role::API
  • Search::Elasticsearch::Client::2_0::Direct

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Elasticsearch BV.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
2018-12-07 perl v5.28.1