Class Client

The Client class

Info:

  • Author: Dhaval Kapil

Fields

Client.cat The cat instance
Client.cluster The cluster instance
Client.indices The indices instance
Client.nodes The nodes instance
Client.snapshot The snapshot instance
Client.tasks The tasks instance

Methods

Client:info () Function to get information regarding the Elasticsearch server
Client:ping () Function to ping to check whether there exists any alive connection to elasticsearch server or not
Client:get (params) Function to get a particular document
Client:exists (params) Function to check whether a document exists or not
Client:getSource (params) Function to get only the _source of a particular document
Client:mget (params) Function to get multiple document
Client:index (params) Function to index a particular document
Client:delete (params) Function to delete a particular document
Client:deleteByQuery (params) Function to delete documents by query
Client:count (params) Function to get the count
Client:countPercolate (params) Count Percolator
Client:mpercolate (params) Function to implement mpercolate
Client:mtermvectors (params) Function to implement mtermvectors
Client:mlt (params) Function to implement more like this query
Client:percolate (params) Function to implement percolate
Client:search (params) Function to search a particular document
Client:searchExists (params) Function to implement the search exists functionality
Client:searchShards (params) Function to search the shards
Client:deleteTemplate (params) Delete Template function
Client:getTemplate (params) Get Template function
Client:putTempalte (params) Put Template function
Client:searchTemplate (params) Function to search the template
Client:scroll (params) Function for scrolled searching
Client:clearScroll (params) Function to clear a scroll
Client:create (params) Function to create a new document
Client:bulk (params) Function to make bulk requests
Client:suggest (params) Function to suggest similar looking terms
Client:explain (params) Function to compute a score explanation for a query and a specific document
Client:update (params) Function to update a particular document
Client:fieldStats (params) Function to get the field stats
Client:reIndex (params) Function to reindex one index to another
Client:renderSearchTemplate (params) Function to render a template
Client:termvectors (params) Function to return information and statistics on terms in the fields
Client:updateByQuery (params) Function to update documents in an index by specifying search query


Fields

Client.cat
The cat instance
Client.cluster
The cluster instance
Client.indices
The indices instance
Client.nodes
The nodes instance
Client.snapshot
The snapshot instance
Client.tasks
The tasks instance

Methods

Client:info ()
Function to get information regarding the Elasticsearch server

Returns:

    table Error or the data received from the elasticsearch server
Client:ping ()
Function to ping to check whether there exists any alive connection to elasticsearch server or not

Returns:

    boolean Whether we have any alive connection or not
Client:get (params)
Function to get a particular document

Parameters:

  • params
    The get Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]              = (string) The document ID (Required)
           ["index"]           = (string) The name of the index (Required)
           ["type"]            = (string) The type of the document (use '_all' to fetch the first document matching the ID across all types) (Required)
           ["ignore_missing"]  = ??
           ["fields"]          = (list) A comma-separated list of fields to return in the response
           ["parent"]          = (string) The ID of the parent document
           ["preference"]      = (string) Specify the node or shard the operation should be performed on (default: random)
           ["realtime"]        = (boolean) Specify whether to perform the operation in realtime or search mode
           ["refresh"]         = (boolean) Refresh the shard containing the document before performing the operation
           ["routing"]         = (string) Specific routing value
           ["_source"]         = (list) True or false to return the _source field or not, or a list of fields to return
           ["_source_exclude"] = (list) A list of fields to exclude from the returned _source field
           ["_source_include"] = (list) A list of fields to extract and return from the _source field
Client:exists (params)
Function to check whether a document exists or not

Parameters:

  • params
    The exists Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]         = (string) The document ID (Required)
           ["index"]      = (string) The name of the index (Required)
           ["type"]       = (string) The type of the document (use '_all' to fetch the first document matching the ID across all types) (Required)
           ["parent"]     = (string) The ID of the parent document
           ["preference"] = (string) Specify the node or shard the operation should be performed on (default: random)
           ["realtime"]   = (boolean) Specify whether to perform the operation in realtime or search mode
           ["refresh"]    = (boolean) Refresh the shard containing the document before performing the operation
           ["routing"]    = (string) Specific routing value
Client:getSource (params)
Function to get only the _source of a particular document

Parameters:

  • params
    The getSource Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]             = (string) The document ID (Required)
           ["index"]          = (string) The name of the index (Required)
           ["type"]           = (string) The type of the document (use '_all' to fetch the first document matching the ID across all types) (Required)
           ["ignore_missing"] = ??
           ["parent"]         = (string) The ID of the parent document
           ["preference"]     = (string) Specify the node or shard the operation should be performed on (default: random)
           ["realtime"]       = (boolean) Specify whether to perform the operation in realtime or search mode
           ["refresh"]        = (boolean) Refresh the shard containing the document before performing the operation
           ["routing"]        = (string) Specific routing value
Client:mget (params)
Function to get multiple document

Parameters:

  • params
    The mget Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]           = (string) The name of the index
           ["type"]            = (string) The type of the document
           ["fields"]          = (list) A comma-separated list of fields to return in the response
           ["parent"]          = (string) The ID of the parent document
           ["preference"]      = (string) Specify the node or shard the operation should be performed on (default: random)
           ["realtime"]        = (boolean) Specify whether to perform the operation in realtime or search mode
           ["refresh"]         = (boolean) Refresh the shard containing the document before performing the operation
           ["routing"]         = (string) Specific routing value
           ["body"]            = (array) Document identifiers; can be either 'docs' (containing full document information) or 'ids' (when index and type is provided in the URL.
           ["_source"]         = (list) True or false to return the _source field or not, or a list of fields to return
           ["_source_exclude"] = (list) A list of fields to exclude from the returned _source field
           ["_source_include"] = (list) A list of fields to extract and return from the _source field
Client:index (params)
Function to index a particular document

Parameters:

  • params
    The index Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]        = (string) The name of the index (Required)
           ["type"]         = (string) The type of the document (Required)
           ["id"]           = (string) Specific document ID (when the POST method is used)
           ["consistency"]  = (enum) Explicit write consistency setting for the operation
           ["op_type"]      = (enum) Explicit operation type
           ["parent"]       = (string) ID of the parent document
           ["refresh"]      = (boolean) Refresh the index after performing the operation
           ["routing"]      = (string) Specific routing value
           ["timeout"]      = (time) Explicit operation timeout
           ["timestamp"]    = (time) Explicit timestamp for the document
           ["ttl"]          = (duration) Expiration time for the document
           ["version"]      = (number) Explicit version number for concurrency control
           ["version_type"] = (enum) Specific version type
           ["body"]         = (array) The document
Client:delete (params)
Function to delete a particular document

Parameters:

  • params
    The delete Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]           = (string) The document ID (Required)
           ["index"]        = (string) The name of the index (Required)
           ["type"]         = (string) The type of the document (Required)
           ["consistency"]  = (enum) Specific write consistency setting for the operation
           ["parent"]       = (string) ID of parent document
           ["refresh"]      = (boolean) Refresh the index after performing the operation
           ["replication"]  = (enum) Specific replication type
           ["routing"]      = (string) Specific routing value
           ["timeout"]      = (time) Explicit operation timeout
           ["version_type"] = (enum) Specific version type
Client:deleteByQuery (params)
Function to delete documents by query

Parameters:

  • params
    The deleteByQuery Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["q"]                  = (string) Query in the Lucene query string syntax
           ["consistency"]        = (enum) Explicit write consistency setting for the operation
           ["ignore_unavailable"] = (bool) Whether specified concrete indices should be ignored when unavailable
           (missing or closed)
           ["allow_no_indices"]   = (bool) Whether to ignore if a wildcard indices expression resolves into no
           concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
           closed or both.
Client:count (params)
Function to get the count

Parameters:

  • params
    The count Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                    = (list) A comma-separated list of indices to restrict the results
           ["type"]                     = (list) A comma-separated list of types to restrict the results
           ["ignore_unavailable"]       = (boolean) Whether specified concrete indices should be ignored when
           unavailable (missing or closed)
           ["allow_no_indices"]         = (boolean) Whether to ignore if a wildcard indices expression resolves into
           no concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]         = (enum) Whether to expand wildcard expression to concrete indices that are
           ["min_score"]                = (number) Include only documents with a specific '_score' value in the
           result
           ["preference"]               = (string) Specify the node or shard the operation should be performed on
           ["routing"]                  = (string) Specific routing value
           ["source"]                   = (string) The URL-encoded query definition (instead of using the request body)
           ["q"]                        = (string) Query in the Lucene query string syntax
           ["analyzer"]                 = (string) The analyzer to use for the query string
           ["analyze_wildcard"]         = (boolean) Specify whether wildcard and prefix queries should be analyzed
           ["default_operator"]         = (enum) The default operator for query string query (AND or OR) (AND,OR)
           ["df"]                       = (string) The field to use as default where no field prefix is given in the
           query string
           ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing
           text to a numeric field) should be ignored
           ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
           ["body"]                     = A query to restrict the results specified with the Query DSL (optional)
Client:countPercolate (params)
Count Percolator

Parameters:

  • params
    The countPercolate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]              = (string) The index of the document being count percolated. (Required)
           ["type"]               = (string) The type of the document being count percolated. (Required)
           ["id"]                 = (string) Substitute the document in the request body with a document that is
           known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document
           from within the cluster. (Required)
           ["routing"]            = (list) A comma-separated list of specific routing values
           ["preference"]         = (string) Specify the node or shard the operation should be performed on
           ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
           (missing or closed)
           ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
           concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
           ["percolate_index"]    = (string) The index to count percolate the document into. Defaults to index.
           ["percolate_type"]     = (string) The type to count percolate document into. Defaults to type.
           ["version"]            = (number) Explicit version number for concurrency control
           ["version_type"]       = (enum) Specific version type (internal,external,external_gte,force)
           ["body"]               = The count percolator request definition using the percolate DSL
Client:mpercolate (params)
Function to implement mpercolate

Parameters:

  • params
    The mpercolate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]              = (string) The index of the document being count percolated to use as default
           ["type"]               = (string) The type of the document being percolated to use as default.
           ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable
           (missing or closed)
           ["allow_no_indices"]   = (boolean) Whether to ignore if a wildcard indices expression resolves into no
           concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open,
           ["body"]               = The percolate request definitions (header & body pair), separated by newlines
Client:mtermvectors (params)
Function to implement mtermvectors

Parameters:

  • params
    The mtermvectors Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]            = (string) The index in which the document resides.
           ["type"]             = (string) The type of the document.
           ["ids"]              = (list) A comma-separated list of documents ids. You must define ids as parameter
           or set "ids" or "docs" in the request body
           ["term_statistics"]  = (boolean) Specifies if total term frequency and document frequency should be
           false)
           ["field_statistics"] = (boolean) Specifies if document count, sum of document frequencies and sum of
           total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body
           ["fields"]           = (list) A comma-separated list of fields to return. Applies to all returned
           documents unless otherwise specified in body "params" or "docs".
           ["offsets"]          = (boolean) Specifies if term offsets should be returned. Applies to all returned
           ["positions"]        = (boolean) Specifies if term positions should be returned. Applies to all returned
           ["payloads"]         = (boolean) Specifies if term payloads should be returned. Applies to all returned
           random) .Applies to all returned documents unless otherwise specified in body "params" or "docs".
           ["routing"]          = (string) Specific routing value. Applies to all returned documents unless
           otherwise specified in body "params" or "docs".
           ["parent"]           = (string) Parent id of documents. Applies to all returned documents unless
           otherwise specified in body "params" or "docs".
           ["realtime"]         = (boolean) Specifies if requests are real-time as opposed to near-real-time
           ["version"]          = (number) Explicit version number for concurrency control
           ["version_type"]     = (enum) Specific version type (internal,external,external_gte,force)
           ["body"]             = Define ids, documents, parameters or a list of parameters per document here. You
           must at least provide a list of document ids. See documentation.
Client:mlt (params)
Function to implement more like this query

Parameters:

  • params
    The mlt Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]                     = (string) The document ID (Required)
           ["index"]                  = (string) The name of the index (Required)
           ["type"]                   = (string) The type of the document (use '_all' to fetch the first document matching the ID across all types) (Required)
           ["boost_terms"]            = (number) The boost factor
           ["max_doc_freq"]           = (number) The word occurrence frequency as count: words with higher occurrence in the corpus will be ignored
           ["max_query_terms"]        = (number) The maximum query terms to be included in the generated query
           ["max_word_len"]           = (number) The minimum length of the word: longer words will be ignored
           ["min_doc_freq"]           = (number) The word occurrence frequency as count: words with lower occurrence in the corpus will be ignored
           ["min_term_freq"]          = (number) The term frequency as percent: terms with lower occurrence in the source document will be ignored
           ["min_word_len"]           = (number) The minimum length of the word: shorter words will be ignored
           ["mlt_fields"]             = (list) Specific fields to perform the query against
           ["percent_terms_to_match"] = (number) How many terms have to match in order to consider the document a match (default: 0.3)
           ["routing"]                = (string) Specific routing value
           ["search_from"]            = (number) The offset from which to return results
           ["search_indices"]         = (list) A comma-separated list of indices to perform the query against (default: the index containing the document)
           ["search_query_hint"]      = (string) The search query hint
           ["search_scroll"]          = (string) A scroll search request definition
           ["search_size"]            = (number) The number of documents to return (default: 10)
           ["search_source"]          = (string) A specific search request definition (instead of using the request body)
           ["search_type"]            = (string) Specific search type (eg. 'dfs_then_fetch', 'count', etc)
           ["search_types"]           = (list) A comma-separated list of types to perform the query against (default: the same type as the document)
           ["stop_words"]             = (list) A list of stop words to be ignored
           ["body"]                   = (array) A specific search request definition
Client:percolate (params)
Function to implement percolate

Parameters:

  • params
    The percolate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                = (string) The index of the document being percolated. (Required)
           ["type"]                 = (string) The type of the document being percolated. (Required)
           ["id"]                   = (string) Substitute the document in the request body with a document that is
           known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document
           from within the cluster. (Required)
           ["routing"]              = (list) A comma-separated list of specific routing values
           ["preference"]           = (string) Specify the node or shard the operation should be performed on
           ["ignore_unavailable"]   = (boolean) Whether specified concrete indices should be ignored when
           unavailable (missing or closed)
           ["allow_no_indices"]     = (boolean) Whether to ignore if a wildcard indices expression resolves into no
           concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]     = (enum) Whether to expand wildcard expression to concrete indices that are
           ["percolate_index"]      = (string) The index to percolate the document into. Defaults to index.
           ["percolate_type"]       = (string) The type to percolate document into. Defaults to type.
           ["percolate_routing"]    = (string) The routing value to use when percolating the existing document.
           ["percolate_preference"] = (string) Which shard to prefer when executing the percolate request.
           ["percolate_format"]     = (enum) Return an array of matching query IDs instead of objects (ids)
           ["version"]              = (number) Explicit version number for concurrency control
           ["version_type"]         = (enum) Specific version type (internal,external,external_gte,force)
           ["body"]                 = The percolator request definition using the percolate DSL
Client:search (params)
Function to search a particular document

Parameters:

  • params
    The search Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                    = (list) A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
           ["type"]                     = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types
           ["analyzer"]                 = (string) The analyzer to use for the query string
           ["analyze_wildcard"]         = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false)
           ["default_operator"]         = (enum) The default operator for query string query (AND or OR)
           ["df"]                       = (string) The field to use as default where no field prefix is given in the query string
           ["explain"]                  = (boolean) Specify whether to return detailed information about score computation as part of a hit
           ["fields"]                   = (list) A comma-separated list of fields to return as part of a hit
           ["from"]                     = (number) Starting offset (default: 0)
           ["ignore_indices"]           = (enum) When performed on multiple indices, allows to ignore 'missing' ones
           ["indices_boost"]            = (list) Comma-separated list of index boosts
           ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
           ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
           ["preference"]               = (string) Specify the node or shard the operation should be performed on (default: random)
           ["q"]                        = (string) Query in the Lucene query string syntax
           ["routing"]                  = (list) A comma-separated list of specific routing values
           ["scroll"]                   = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
           ["search_type"]              = (enum) Search operation type
           ["size"]                     = (number) Number of hits to return (default: 10)
           ["sort"]                     = (list) A comma-separated list of <field>:<direction> pairs
           ["source"]                   = (string) The URL-encoded request definition using the Query DSL (instead of using request body)
           ["_source"]                  = (list) True or false to return the _source field or not, or a list of fields to return
           ["_source_exclude"]          = (list) A list of fields to exclude from the returned _source field
           ["_source_include"]          = (list) A list of fields to extract and return from the _source field
           ["stats"]                    = (list) Specific "tag" of the request for logging and statistical purposes
           ["suggest_field"]            = (string) Specify which field to use for suggestions
           ["suggest_mode"]             = (enum) Specify suggest mode
           ["suggest_size"]             = (number) How many suggestions to return in response
           ["suggest_text"]             = (text) The source text for which the suggestions should be returned
           ["timeout"]                  = (time) Explicit operation timeout
           ["version"]                  = (boolean) Specify whether to return document version as part of a hit
           ["body"]                     = (array|string) The search definition using the Query DSL
Client:searchExists (params)
Function to implement the search exists functionality

Parameters:

  • params
    The searchExists Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                    = (list) A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
           ["type"]                     = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types
           ["analyzer"]                 = (string) The analyzer to use for the query string
           ["analyze_wildcard"]         = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false)
           ["default_operator"]         = (enum) The default operator for query string query (AND or OR)
           ["df"]                       = (string) The field to use as default where no field prefix is given in the query string
           ["explain"]                  = (boolean) Specify whether to return detailed information about score computation as part of a hit
           ["fields"]                   = (list) A comma-separated list of fields to return as part of a hit
           ["from"]                     = (number) Starting offset (default: 0)
           ["ignore_indices"]           = (enum) When performed on multiple indices, allows to ignore 'missing' ones
           ["indices_boost"]            = (list) Comma-separated list of index boosts
           ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
           ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
           ["preference"]               = (string) Specify the node or shard the operation should be performed on (default: random)
           ["q"]                        = (string) Query in the Lucene query string syntax
           ["routing"]                  = (list) A comma-separated list of specific routing values
           ["scroll"]                   = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
           ["search_type"]              = (enum) Search operation type
           ["size"]                     = (number) Number of hits to return (default: 10)
           ["sort"]                     = (list) A comma-separated list of <field>:<direction> pairs
           ["source"]                   = (string) The URL-encoded request definition using the Query DSL (instead of using request body)
           ["_source"]                  = (list) True or false to return the _source field or not, or a list of fields to return
           ["_source_exclude"]          = (list) A list of fields to exclude from the returned _source field
           ["_source_include"]          = (list) A list of fields to extract and return from the _source field
           ["stats"]                    = (list) Specific "tag" of the request for logging and statistical purposes
           ["suggest_field"]            = (string) Specify which field to use for suggestions
           ["suggest_mode"]             = (enum) Specify suggest mode
           ["suggest_size"]             = (number) How many suggestions to return in response
           ["suggest_text"]             = (text) The source text for which the suggestions should be returned
           ["timeout"]                  = (time) Explicit operation timeout
           ["version"]                  = (boolean) Specify whether to return document version as part of a hit
           ["body"]                     = (array|string) The search definition using the Query DSL
Client:searchShards (params)
Function to search the shards

Parameters:

  • params
    The searchShards Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]              = (list) A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
           ["type"]               = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types
           ["preference"]         = (string) Specify the node or shard the operation should be performed on (default: random)
           ["routing"]            = (string) Specific routing value
           ["local"]              = (bool) Return local information, do not retrieve the state from master node (default: false)
           ["ignore_unavailable"] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed)
           ["allow_no_indices"]   = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
Client:deleteTemplate (params)
Delete Template function

Parameters:

  • params
    The deleteTemplate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]           = (string) Template ID (Required)
           ["version"]      = (number) Explicit version number for concurrency control
           ["version_type"] = (enum) Specific version type (internal,external,external_gte,force)
Client:getTemplate (params)
Get Template function

Parameters:

  • params
    The getTemplate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]           = (string) Template ID (Required)
           ["version"]      = (number) Explicit version number for concurrency control
           ["version_type"] = (enum) Specific version type (internal,external,external_gte,force)
Client:putTempalte (params)
Put Template function

Parameters:

  • params
    The putTemplate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]           = (string) Template ID (Required)
           ["version"]      = (number) Explicit version number for concurrency control
           ["version_type"] = (enum) Specific version type (internal,external,external_gte,force)
           ["body"]         = The document
Client:searchTemplate (params)
Function to search the template

Parameters:

  • params
    The searchTemplate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                    = (list) A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
           ["type"]                     = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types
Client:scroll (params)
Function for scrolled searching

Parameters:

  • params
    The scroll Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["scroll_id"] = (string) The scroll ID for scrolled search
           ["scroll"]    = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
           ["body"]      = (string) The scroll ID for scrolled search
Client:clearScroll (params)
Function to clear a scroll

Parameters:

  • params
    The clearScroll Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["scroll_id"] = (string) The scroll ID for scrolled search
           ["scroll"]    = (duration) Specify how long a consistent view of the index should be maintained for scrolled search
           ["body"]      = (string) The scroll ID for scrolled search
Client:create (params)
Function to create a new document

Parameters:

  • params
    The create Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]        = (string) The name of the index (Required)
           ["type"]         = (string) The type of the document (Required)
           ["id"]           = (string) Specific document ID (when the POST method is used)
           ["consistency"]  = (enum) Explicit write consistency setting for the operation
           ["parent"]       = (string) ID of the parent document
           ["percolate"]    = (string) Percolator queries to execute while indexing the document
           ["refresh"]      = (boolean) Refresh the index after performing the operation
           ["replication"]  = (enum) Specific replication type
           ["routing"]      = (string) Specific routing value
           ["timeout"]      = (time) Explicit operation timeout
           ["timestamp"]    = (time) Explicit timestamp for the document
           ["ttl"]          = (duration) Expiration time for the document
           ["version"]      = (number) Explicit version number for concurrency control
           ["version_type"] = (enum) Specific version type
           ["body"]         = (array) The document
Client:bulk (params)
Function to make bulk requests

Parameters:

  • params
    The bulk Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]       = (string) Default index for items which don"t provide one
           ["type"]        = (string) Default document type for items which don"t provide one
           ["consistency"] = (enum) Explicit write consistency setting for the operation
           ["refresh"]     = (boolean) Refresh the index after performing the operation
           ["replication"] = (enum) Explicitly set the replication type
           ["body"]        = (array) Array of requests
Client:suggest (params)
Function to suggest similar looking terms

Parameters:

  • params
    The suggest Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]          = (list) A comma-separated list of index names to restrict the operation; use '_all' or empty string to perform the operation on all indices
           ["ignore_indices"] = (enum) When performed on multiple indices, allows to ignore 'missing' ones
           ["preference"]     = (string) Specify the node or shard the operation should be performed on (default: random)
           ["routing"]        = (string) Specific routing value
           ["source"]         = (string) The URL-encoded request definition (instead of using request body)
           ["body"]           = (array) The request definition
Client:explain (params)
Function to compute a score explanation for a query and a specific document

Parameters:

  • params
    The explain Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]                       = (string) The document ID (Required)
           ["index"]                    = (string) The name of the index (Required)
           ["type"]                     = (string) The type of the document (Required)
           ["analyze_wildcard"]         = (boolean) Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)
           ["analyzer"]                 = (string) The analyzer for the query string query
           ["default_operator"]         = (enum) The default operator for query string query (AND or OR)
           ["df"]                       = (string) The default field for query string query (default: _all)
           ["fields"]                   = (list) A comma-separated list of fields to return in the response
           ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
           ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
           ["parent"]                   = (string) The ID of the parent document
           ["preference"]               = (string) Specify the node or shard the operation should be performed on (default: random)
           ["q"]                        = (string) Query in the Lucene query string syntax
           ["routing"]                  = (string) Specific routing value
           ["source"]                   = (string) The URL-encoded query definition (instead of using the request body)
           ["_source"]                  = (list) True or false to return the _source field or not, or a list of fields to return
           ["_source_exclude"]          = (list) A list of fields to exclude from the returned _source field
           ["_source_include"]          = (list) A list of fields to extract and return from the _source field
           ["body"]                     = (string) The URL-encoded query definition (instead of using the request body)
Client:update (params)
Function to update a particular document

Parameters:

  • params
    The update Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]                = (string) Document ID (Required)
           ["index"]             = (string) The name of the index (Required)
           ["type"]              = (string) The type of the document (Required)
           ["consistency"]       = (enum) Explicit write consistency setting for the operation
           ["fields"]            = (list) A comma-separated list of fields to return in the response
           ["lang"]              = (string) The script language (default: mvel)
           ["parent"]            = (string) ID of the parent document
           ["percolate"]         = (string) Perform percolation during the operation; use specific registered query name, attribute, or wildcard
           ["refresh"]           = (boolean) Refresh the index after performing the operation
           ["replication"]       = (enum) Specific replication type
           ["retry_on_conflict"] = (number) Specify how many times should the operation be retried when a conflict occurs (default: 0)
           ["routing"]           = (string) Specific routing value
           ["script"]            = () The URL-encoded script definition (instead of using request body)
           ["timeout"]           = (time) Explicit operation timeout
           ["timestamp"]         = (time) Explicit timestamp for the document
           ["ttl"]               = (duration) Expiration time for the document
           ["version_type"]      = (number) Explicit version number for concurrency control
           ["body"]              = (array) The request definition using either 'script' or partial 'doc'
Client:fieldStats (params)
Function to get the field stats

Parameters:

  • params
    The fieldStats Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]              = (list) A comma-separated list of indices to restrict the results
           ["fields"]             = (list) A comma-separated list of fields for to get field statistics for (min value, max value, and more)
           ["level"]              = (enum) Defines if field stats should be returned on a per index level or on a cluster wide level
           ["ignore_unavailable"] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed)
           ["allow_no_indices"]   = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified)
           ["expand_wildcards"]   = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both.
Client:reIndex (params)
Function to reindex one index to another

Parameters:

  • params
    The reIndex Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["refresh"]             = (boolean) Should the effected indexes be refreshed?
           ["timeout"]             = (time) Time each individual bulk request should wait for shards that are
           ["consistency"]         = (enum) Explicit write consistency setting for the operation (one,quorum,all)
           ["wait_for_completion"] = (boolean) Should the request should block until the reindex is complete.
           ["body"]                = The search definition using the Query DSL and the prototype for the index
           request.
Client:renderSearchTemplate (params)
Function to render a template

Parameters:

  • params
    The renderSearchTemplate Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["id"]   = (string) The id of the stored search template
           ["body"] = The search definition template and its params
Client:termvectors (params)
Function to return information and statistics on terms in the fields

Parameters:

  • params
    The termvectors Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]            = (string) The index in which the document resides. (Required)
           ["type"]             = (string) The type of the document. (Required)
           ["id"]               = (string) The id of the document, when not specified a doc param should be
           supplied.
           ["term_statistics"]  = (boolean) Specifies if total term frequency and document frequency should be
           ["field_statistics"] = (boolean) Specifies if document count, sum of document frequencies and sum of
           ["dfs"]              = (boolean) Specifies if distributed frequencies should be returned instead shard
           ["fields"]           = (list) A comma-separated list of fields to return.
           random).
           ["routing"]          = (string) Specific routing value.
           ["parent"]           = (string) Parent id of documents.
           true).
           ["version"]          = (number) Explicit version number for concurrency control
           ["version_type"]     = (enum) Specific version type (internal,external,external_gte,force)
           ["body"]             = Define parameters and or supply a document to get termvectors for. See
           documentation.
Client:updateByQuery (params)
Function to update documents in an index by specifying search query

Parameters:

  • params
    The termvectors Parameters
    

Returns:

    table Error or the data received from the elasticsearch server

Usage:

     params["index"]                    = (list) A comma-separated list of index names to search; use '_all' or
           empty string to perform the operation on all indices (Required)
           ["type"]                     = (list) A comma-separated list of document types to search; leave empty to
           perform the operation on all types
           ["analyzer"]                 = (string) The analyzer to use for the query string
           ["analyze_wildcard"]         = (boolean) Specify whether wildcard and prefix queries should be analyzed
           ["default_operator"]         = (enum) The default operator for query string query (AND or OR) (AND,OR)
           ["df"]                       = (string) The field to use as default where no field prefix is given in the
           query string
           ["explain"]                  = (boolean) Specify whether to return detailed information about score
           computation as part of a hit
           ["fields"]                   = (list) A comma-separated list of fields to return as part of a hit
           ["fielddata_fields"]         = (list) A comma-separated list of fields to return as the field data
           representation of a field for each hit
           ["ignore_unavailable"]       = (boolean) Whether specified concrete indices should be ignored when
           unavailable (missing or closed)
           ["allow_no_indices"]         = (boolean) Whether to ignore if a wildcard indices expression resolves into
           no concrete indices. (This includes '_all' string or when no indices have been specified)
           ["conflicts"]                = (enum) What to do when the reindex hits version conflicts? (abort,proceed)
           ["expand_wildcards"]         = (enum) Whether to expand wildcard expression to concrete indices that are
           ["lenient"]                  = (boolean) Specify whether format-based query failures (such as providing
           text to a numeric field) should be ignored
           ["lowercase_expanded_terms"] = (boolean) Specify whether query terms should be lowercased
           ["preference"]               = (string) Specify the node or shard the operation should be performed on
           ["q"]                        = (string) Query in the Lucene query string syntax
           ["routing"]                  = (list) A comma-separated list of specific routing values
           ["scroll"]                   = (duration) Specify how long a consistent view of the index should be
           maintained for scrolled search
           ["search_type"]              = (enum) Search operation type (query_then_fetch,dfs_query_then_fetch)
           ["search_timeout"]           = (time) Explicit timeout for each search request. Defaults to no timeout.
           ["sort"]                     = (list) A comma-separated list of <field>:<direction> pairs
           ["_source"]                  = (list) True or false to return the _source field or not, or a list of
           fields to return
           ["_source_exclude"]          = (list) A list of fields to exclude from the returned _source field
           ["_source_include"]          = (list) A list of fields to extract and return from the _source field
           ["terminate_after"]          = (number) The maximum number of documents to collect for each shard, upon
           reaching which the query execution will terminate early.
           ["stats"]                    = (list) Specific "tag" of the request for logging and statistical purposes
           ["suggest_field"]            = (string) Specify which field to use for suggestions
           ["suggest_size"]             = (number) How many suggestions to return in response
           ["suggest_text"]             = (text) The source text for which the suggestions should be returned
           ["timeout"]                  = (time) Time each individual bulk request should wait for shards that are
           ["track_scores"]             = (boolean) Whether to calculate and return scores even if they are not used
           for sorting
           ["version"]                  = (boolean) Specify whether to return document version as part of a hit
           ["version_type"]             = (boolean) Should the document increment the version number (internal) on
           hit or not (reindex)
           ["request_cache"]            = (boolean) Specify if request cache should be used for this request or not,
           defaults to index level setting
           ["refresh"]                  = (boolean) Should the effected indexes be refreshed?
           ["consistency"]              = (enum) Explicit write consistency setting for the operation
           (one,quorum,all)
           ["scroll_size"]              = (integer) Size on the scroll request powering the update_by_query
           ["wait_for_completion"]      = (boolean) Should the request should block until the reindex is complete.
           ["body"]                     = The search definition using the Query DSL
generated by LDoc 1.4.3 Last updated 2016-10-29 22:14:22