NAME

OpenSearch::Client::Core::3_0::Direct::KNN

VERSION

version 3.007002

SYNOPSIS

use OpenSearch::Client;

my $client = OpenSearch::Client->new( ... );

my $response = $client->knn-><methodname>(
  valone => $value1,
  valtwo => $value2
);

DESCRIPTION

Vector search API

In OpenSearch, vector search functionality is provided by the k-NN plugin and Neural Search plugin. The k-NN plugin provides basic k-NN functionality, while the Neural Search plugin provides automatic embedding generation at indexing and search time.

See OpenSearch documentation for knn.

METHODS

knn->delete_model

Used to delete a particular model in the cluster.

Paths served by this method:

DELETE /_plugins/_knn/models/{model_id}
$resp = $client->knn->delete_model(
    
     # path parameters
    
    'model_id'     =>  $model_id,  # required
    
     # Common API query string parameters
    
    'error_trace'  =>  $qval1,     # boolean
    'filter_path'  =>  $qval2,     # list
    'human'        =>  $qval3,     # boolean
    'pretty'       =>  $qval4,     # boolean
    'source'       =>  $qval5,     # string
);

OpenSearch documentation for knn.delete_model

knn->get_model

Used to retrieve information about models present in the cluster.

Paths served by this method:

GET /_plugins/_knn/models/{model_id}
$resp = $client->knn->get_model(
    
     # path parameters
    
    'model_id'     =>  $model_id,  # required
    
     # Common API query string parameters
    
    'error_trace'  =>  $qval1,     # boolean
    'filter_path'  =>  $qval2,     # list
    'human'        =>  $qval3,     # boolean
    'pretty'       =>  $qval4,     # boolean
    'source'       =>  $qval5,     # string
);

OpenSearch documentation for knn.get_model

knn->search_models

Use an OpenSearch query to search for models in the index.

Paths served by this method:

POST /_plugins/_knn/models/_search
$resp = $client->knn->search_models(
    
    'body'                           =>  $body,      # optional
    
     # Endpoint specific query string parameters
    
    '_source'                        =>  $qval1,     # list
    '_source_excludes'               =>  $qval2,     # list
    '_source_includes'               =>  $qval3,     # list
    'allow_no_indices'               =>  $qval4,     # boolean
    'allow_partial_search_results'   =>  $qval5,     # boolean
    'analyze_wildcard'               =>  $qval6,     # boolean
    'analyzer'                       =>  $qval7,     # string
    'batched_reduce_size'            =>  $qval8,     # number
    'ccs_minimize_roundtrips'        =>  $qval9,     # boolean
    'default_operator'               =>  $qval10,    # string
    'df'                             =>  $qval11,    # string
    'docvalue_fields'                =>  $qval12,    # list
    'expand_wildcards'               =>  $qval13,    # list
    'explain'                        =>  $qval14,    # boolean
    'from'                           =>  $qval15,    # number
    'ignore_throttled'               =>  $qval16,    # boolean
    'ignore_unavailable'             =>  $qval17,    # boolean
    'lenient'                        =>  $qval18,    # boolean
    'max_concurrent_shard_requests'  =>  $qval19,    # number
    'pre_filter_shard_size'          =>  $qval20,    # number
    'preference'                     =>  $qval21,    # string
    'q'                              =>  $qval22,    # string
    'request_cache'                  =>  $qval23,    # boolean
    'rest_total_hits_as_int'         =>  $qval24,    # boolean
    'routing'                        =>  $qval25,    # list
    'scroll'                         =>  $qval26,    # string
    'search_type'                    =>  $qval27,    # string
    'seq_no_primary_term'            =>  $qval28,    # boolean
    'size'                           =>  $qval29,    # number
    'sort'                           =>  $qval30,    # list
    'stats'                          =>  $qval31,    # list
    'stored_fields'                  =>  $qval32,    # list
    'suggest_field'                  =>  $qval33,    # string
    'suggest_mode'                   =>  $qval34,    # string
    'suggest_size'                   =>  $qval35,    # number
    'suggest_text'                   =>  $qval36,    # string
    'terminate_after'                =>  $qval37,    # number
    'timeout'                        =>  $qval38,    # string
    'track_scores'                   =>  $qval39,    # boolean
    'track_total_hits'               =>  $qval40,    # boolean
    'typed_keys'                     =>  $qval41,    # boolean
    'version'                        =>  $qval42,    # boolean
    
     # Common API query string parameters
    
    'error_trace'                    =>  $qval43,    # boolean
    'filter_path'                    =>  $qval44,    # list
    'human'                          =>  $qval45,    # boolean
    'pretty'                         =>  $qval46,    # boolean
    'source'                         =>  $qval47,    # string
);

OpenSearch documentation for knn.search_models

knn->stats

Provides information about the current status of the k-NN plugin.

Paths served by this method:

GET /_plugins/_knn/stats
GET /_plugins/_knn/stats/{stat}
GET /_plugins/_knn/{node_id}/stats
GET /_plugins/_knn/{node_id}/stats/{stat}
$resp = $client->knn->stats(
    
     # path parameters
    
    'node_id'      =>  $node_id,   # optional
    'stat'         =>  $stat,      # optional
    
     # Endpoint specific query string parameters
    
    'timeout'      =>  $qval1,     # string
    
     # Common API query string parameters
    
    'error_trace'  =>  $qval2,     # boolean
    'filter_path'  =>  $qval3,     # list
    'human'        =>  $qval4,     # boolean
    'pretty'       =>  $qval5,     # boolean
    'source'       =>  $qval6,     # string
);

OpenSearch documentation for knn.stats

knn->train_model

Create and train a model that can be used for initializing k-NN native library indexes during indexing.

Paths served by this method:

POST /_plugins/_knn/models/_train
POST /_plugins/_knn/models/{model_id}/_train
$resp = $client->knn->train_model(
    
    'body'         =>  $body,      # optional
    
     # path parameters
    
    'model_id'     =>  $model_id,  # optional
    
     # Endpoint specific query string parameters
    
    'preference'   =>  $qval1,     # string
    
     # Common API query string parameters
    
    'error_trace'  =>  $qval2,     # boolean
    'filter_path'  =>  $qval3,     # list
    'human'        =>  $qval4,     # boolean
    'pretty'       =>  $qval5,     # boolean
    'source'       =>  $qval6,     # string
);

OpenSearch documentation for knn.train_model

knn->warmup

Preloads native library files into memory, reducing initial search latency for specified indexes.

Paths served by this method:

GET /_plugins/_knn/warmup/{index}
$resp = $client->knn->warmup(
    
     # path parameters
    
    'index'        =>  $index,     # required
    
     # Common API query string parameters
    
    'error_trace'  =>  $qval1,     # boolean
    'filter_path'  =>  $qval2,     # list
    'human'        =>  $qval3,     # boolean
    'pretty'       =>  $qval4,     # boolean
    'source'       =>  $qval5,     # string
);

OpenSearch documentation for knn.warmup

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