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

πŸ“¦
version 8.12 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Search::Elasticsearch::Client::8_0::Role::API β€” bestie, this class is literally the spec for all the Elasticsearch APIs. That's it, that's the whole job. (And yes, this is the Search...le::API(3pm) page you're reading rn, in case you were wondering πŸ’…)


🌸 VERSION 🌸

version 8.12 β€” iconic, we stay current 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, listen. Every single Elasticsearch API is defined in this role. All of them. The whole roster. And the example down below is the definition for the "index()" in the Search::Elasticsearch::Client::8_0::Direct method, so you can see exactly the vibe we're working with:

'index' => {
    body   => { required => 1 },
    doc    => "docs-index_",
    method => "POST",
    parts  => { id => {}, index => {}, type => {} },
    paths  => [
        [   { id => 2, index => 0, type => 1 }, "{index}",
            "{type}",                           "{id}"
        ],
        [ { id    => 2, index => 0 }, "{index}", "_doc", "{id}" ],
        [ { index => 0, type  => 1 }, "{index}", "{type}" ],
        [ { index => 0 }, "{index}", "_doc" ],
    ],
    qs => {
        error_trace            => "boolean",
        filter_path            => "list",
        human                  => "boolean",
        if_primary_term        => "number",
        if_seq_no              => "number",
        op_type                => "enum",
        pipeline               => "string",
        refresh                => "enum",
        require_alias          => "boolean",
        routing                => "string",
        timeout                => "time",
        version                => "number",
        version_type           => "enum",
        wait_for_active_shards => "string",
    },
}

So these definitions can be used by different Search::Elasticsearch::Role::Client implementations to provide distinct user interfaces. Different clients, same spec, matching outfits fr fr πŸ‘‘


πŸŽ€ METHODS πŸŽ€

πŸ’– api()

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

The only method in this whole class is the api() method, and what it does is so cute and simple: you hand it the name of the action, and it hands you back that action's definition. That's the whole relationship. πŸ₯°

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 just walks in front like it owns the place? Periodt. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

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

Go read those too, bestie, they're the whole friend group 🌈


πŸ’œ AUTHOR πŸ’œ

Enrico Zimuel <enrico.zimuel@elastic.co> β€” the author himself, respect the icon 🫢


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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

Legal stuff but make it slay πŸ’…


And that's a wrap, gorgeous! πŸŽ€ This was perl v5.38.2, dated 2024-02-04, and it's the Search...le::API(3pm) page β€” no cap, you understood all of it, main character energy only, bye bestie! πŸ’–βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from