NAME

OpenSearch::Client::CxnPool::Sniff - A CxnPool for connecting to a local cluster with a dynamic node list

VERSION

version 3.007002

SYNOPSIS

$e = OpenSearch::Client->new(
    cxn_pool => 'Sniff',
    nodes    => [
        'search1:9200',
        'search2:9200'
    ],
);

DESCRIPTION

The Sniff connection pool should be used when you do have direct access to the OpenSearch cluster, eg when your client servers and OpenSearch servers are on the same network. The nodes that you specify are used to discover the cluster, which is then sniffed to find the current list of live nodes that the cluster knows about.

This sniff process is repeated regularly, or whenever a node fails, to update the list of healthy nodes. So if you add more nodes to your cluster, they will be auto-discovered during a sniff.

If all sniffed nodes fail, then it falls back to sniffing the original seed nodes that you specified in new().

For HTTP Cxn classes, this module will also dynamically detect the max_content_length which the nodes in the cluster will accept.

This class does OpenSearch::Client::Role::CxnPool::Sniff and OpenSearch::Client::Role::Is_Sync.

CONFIGURATION

nodes

The list of nodes to use to discover the cluster. Can accept a single node, multiple nodes, and defaults to localhost:9200 if no nodes are specified. See "node" in OpenSearch::Client::Role::Cxn for details of the node specification.

See also

Inherited configuration

From OpenSearch::Client::Role::CxnPool::Sniff

From OpenSearch::Client::Role::CxnPool

METHODS

next_cxn()

$cxn = $cxn_pool->next_cxn

Returns the next available live node (in round robin fashion), or throws a NoNodes error if no nodes can be sniffed from the cluster.

schedule_check()

$cxn_pool->schedule_check

Forces a sniff before the next Cxn is returned, to updated the list of healthy nodes in the cluster.

sniff()

$bool = $cxn_pool->sniff

Sniffs the cluster and returns true if the sniff was successful.

Inherited methods

From OpenSearch::Client::Role::CxnPool::Sniff

From OpenSearch::Client::Role::CxnPool

MANUAL

Documentation index OpenSearch::Client::Manual

HISTORY

This distribution is derived from Search::Elasticsearch version 7.714. All subsequent changes are unique to this distribution.

AUTHOR

Mark Dootson <mdootson@cpan.org> ( current maintainer )

CREDITS

OpenSearch::Client is based on Search::Elasticsearch version 7.714 by Enrico Zimuel <enrico.zimuel@elastic.co>.

COPYRIGHT AND LICENSE

Copyright (C) 2026 by Mark Dootson ( this distribution )

Copyright (C) 2021 by Elasticsearch BV ( original distribution )

This is free software, licensed under:

The Apache License, Version 2.0, January 2004