Search...le::API(3pm)

πŸ“¦
version 6.81 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

ok so bestie, welcome to Search::Elasticsearch::Client::1_0::Role::API β€” this class is literally just the spec for the Elasticsearch APIs. that's it. that's the whole job. it holds the receipts for every API call. πŸ‘‘

it's the Search::Elasticsearch::Client::1_0::Role::API manual page, perl-flavored, and yes it's a role (a Perl thing, iykyk). πŸŽ€


✨ VERSION ✨

version 6.81 β€” this is the one, no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: all of the Elasticsearch APIs are defined in this role. like, every single one. 🫢

and the example below? that's the definition for the index() method in the Search::Elasticsearch::Client::1_0::Direct method. look at it. it's giving organized. it's giving structured. it's giving main character energy:

'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 => {
        filter_path            => "list",
        op_type                => "enum",
        parent                 => "string",
        pipeline               => "string",
        refresh                => "enum",
        routing                => "string",
        timeout                => "time",
        timestamp              => "time",
        ttl                    => "time",
        version                => "number",
        version_type           => "enum",
        wait_for_active_shards => "string",
    },
},

and why does this exist, you ask? because these definitions can be used by different Search::Elasticsearch::Role::Client implementations to provide distinct user interfaces. one spec, many fits. versatile icon behavior. 🌈


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ api()

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

ngl, there's literally only one method in this class and it's api(). she's the whole squad.

what she does: you hand her the name of an action, she hands you back its definition. very give-and-take. very healthy communication. πŸ’–

oh and heads up β€” 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 how the namespace is just chillin' at the front with a dot? yeah. that's the vibe. lowkey elegant. 😭


🌸 SEE ALSO 🌸

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

go read those too bestie, they're the supporting cast and they ate. 🫢


⭐ AUTHOR ⭐

Enrico Zimuel <enrico.zimuel@elastic.co> β€” iconic. legendary. we thank him for his service. πŸ™ˆ


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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004
ok so real talk: it's free software, and it's licensed under the Apache License, Version 2.0, January 2004. that's a legal thing so we're saying it exactly how it is, no remixing. respect the license bestie. πŸ’…

that's a wrap! πŸ¦‹ this was Search...le::API(3pm) β€” perl v5.36.0, dated 2022-08-28, and yes that footer is the last bit of lore. slay, stay hydrated, and go read your specs. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from