Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Latest commit

 

History

History
5353 lines (4116 loc) · 210 KB

api_methods.asciidoc

File metadata and controls

5353 lines (4116 loc) · 210 KB

7.4 API

Note
This is currently the default API, but in upcoming versions that will change. We recommend setting the apiVersion config param when you instantiate your client to make sure that the API does not change unexpectedly.

bulk

client.bulk([params, [callback]])

Perform many index/delete operations in a single API call.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Perform three operations in a single request
client.bulk({
  body: [
    // action description
    { index:  { _index: 'myindex', _type: 'mytype', _id: 1 } },
     // the document to index
    { title: 'foo' },
    // action description
    { update: { _index: 'myindex', _type: 'mytype', _id: 2 } },
    // the document to update
    { doc: { title: 'foo' } },
    // action description
    { delete: { _index: 'myindex', _type: 'mytype', _id: 3 } },
    // no document needed for this delete
  ]
}, function (err, resp) {
  // ...
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

refresh

String — If true then refresh the effected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

Options
  • "true"

  • "false"

  • "wait_for"

  • ""

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

type

String — Default document type for items which don’t provide one

_source

String, String[], Boolean — True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request

_sourceExcludes

String, String[], Boolean — Default list of fields to exclude from the returned _source field, can be overridden on each sub-request

_sourceIncludes

String, String[], Boolean — Default list of fields to extract and return from the _source field, can be overridden on each sub-request

pipeline

String — The pipeline id to preprocess incoming documents with

index

String — Default index for items which don’t provide one

body

Object[], JSONLines — The request body, as either an array of objects or new-line delimited JSON objects. See the elasticsearch docs for details about what can be specified here.

clearScroll

client.clearScroll([params, [callback]])

Clear the scroll request created by specifying the scroll parameter to search.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

scrollId

String, String[], Boolean — A comma-separated list of scroll IDs to clear

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

count

client.count([params, [callback]])

Get the number of documents for the cluster, index, type, or a query.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Get the number of all documents in the cluster
const { count } = await client.count();
Get the number of documents in an index
const { count } = await client.count({
  index: 'index_name'
});
Get the number of documents matching a query
const { count } = await client.count({
  index: 'index_name',
  body: {
    query: {
      filtered: {
        filter: {
          terms: {
            foo: ['bar']
          }
        }
      }
    }
  }
});

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

ignoreThrottled

Boolean — Whether specified concrete, expanded or aliased indices should be ignored when throttled

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

minScore

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 (default: random)

routing

String, String[], Boolean — A comma-separated list of specific routing values

q

String — Query in the Lucene query string syntax

analyzer

String — The analyzer to use for the query string

analyzeWildcard

Boolean — Specify whether wildcard and prefix queries should be analyzed (default: false)

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "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

terminateAfter

Number — The maximum count for each shard, upon reaching which the query execution will terminate early

index

String, String[], Boolean — A comma-separated list of indices to restrict the results

type

String, String[], Boolean — A comma-separated list of types to restrict the results

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

create

client.create([params, [callback]])

Adds a typed JSON document in a specific index, making it searchable. If a document with the same index, type, and id already exists, an error will occur.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Create a document
await client.create({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    title: 'Test 1',
    tags: ['y', 'z'],
    published: true,
    published_at: '2013-01-01',
    counter: 1
  }
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

refresh

String — If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

Options
  • "true"

  • "false"

  • "wait_for"

  • ""

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

pipeline

String — The pipeline id to preprocess incoming documents with

id

String — Document ID

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

delete

client.delete([params, [callback]])

Delete a typed JSON document from a specific index based on its id.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Delete the document /myindex/mytype/1
await client.delete({
  index: 'myindex',
  type: 'mytype',
  id: '1'
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

refresh

String — If true then refresh the effected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

Options
  • "true"

  • "false"

  • "wait_for"

  • ""

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

ifSeqNo

Number — only perform the delete operation if the last operation that has changed the document has the specified sequence number

ifPrimaryTerm

Number — only perform the delete operation if the last operation that has changed the document has the specified primary term

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

id

String — The document ID

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

deleteByQuery

client.deleteByQuery([params, [callback]])

Delete documents from one or more indices and one or more types based on a query.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Deleting documents with a simple query
await client.deleteByQuery({
  index: 'myindex',
  q: 'test'
});
Deleting documents using the Query DSL
await client.deleteByQuery({
  index: 'posts',
  body: {
    query: {
      term: { published: false }
    }
  }
});

Params

analyzer

String — The analyzer to use for the query string

analyzeWildcard

Boolean — Specify whether wildcard and prefix queries should be analyzed (default: false)

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "AND"

  • "OR"

df

String — The field to use as default where no field prefix is given in the query string

from

Number — Starting offset (default: 0)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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=abort]

String — What to do when the delete by query hits version conflicts?

Options
  • "abort"

  • "proceed"

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

lenient

Boolean — Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

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, String[], Boolean — A comma-separated list of specific routing values

scroll

DurationString — Specify how long a consistent view of the index should be maintained for scrolled search

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "dfs_query_then_fetch"

searchTimeout

DurationString — Explicit timeout for each search request. Defaults to no timeout.

size

Number — Deprecated, please use max_docs instead

maxDocs

Number — Maximum number of documents to process (default: all documents)

sort

String, String[], Boolean — A comma-separated list of <field>:<direction> pairs

_source

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

terminateAfter

Number — The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

stats

String, String[], Boolean — Specific 'tag' of the request for logging and statistical purposes

version

Boolean — Specify whether to return document version as part of a hit

requestCache

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?

[timeout=1m]

DurationString — Time each individual bulk request should wait for shards that are unavailable.

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

scrollSize

Number — Size on the scroll request powering the delete by query

[waitForCompletion=true]

Boolean — Should the request should block until the delete by query is complete.

requestsPerSecond

Number — The throttle for this request in sub-requests per second. -1 means no throttle.

[slices=1]

Number — The number of slices this task should be divided into. Defaults to 1 meaning the task isn’t sliced into subtasks.

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

type

String, String[], Boolean — A comma-separated list of document types to search; leave empty to perform the operation on all types

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

deleteByQueryRethrottle

client.deleteByQueryRethrottle([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

requestsPerSecond

Number — The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

taskId

String — The task id to rethrottle

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

deleteScript

client.deleteScript([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

id

String — Script ID

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

exists

client.exists([params, [callback]])

Returns a boolean indicating whether or not a given document exists.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Check that the document /myindex/mytype/1 exist
const exists = await client.exists({
  index: 'myindex',
  type: 'mytype',
  id: 1
});

Params

storedFields

String, String[], Boolean — A comma-separated list of stored fields to return in the response

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

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

id

String — The document ID

index

String — The name of the index

type

String — The type of the document (use _all to fetch the first document matching the ID across all types)

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

existsSource

client.existsSource([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

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

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

id

String — The document ID

index

String — The name of the index

type

String — The type of the document; deprecated and optional starting with 7.0

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

explain

client.explain([params, [callback]])

Provides details about a specific document’s score in relation to a specific query. It will also tell you if the document matches the specified query.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

See how a document is scored against a simple query
const response = await client.explain({
  // the document to test
  index: 'myindex',
  type: 'mytype',
  id: '1',

  // the query to score it against
  q: 'field:value'
});
See how a document is scored against a query written in the Query DSL
const response = await client.explain({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    query: {
      match: { title: 'test' }
    }
  }
});

Params

analyzeWildcard

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

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "AND"

  • "OR"

df

String — The default field for query string query (default: _all)

storedFields

String, String[], Boolean — A comma-separated list of stored 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

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, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

id

String — The document ID

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

fieldCaps

client.fieldCaps([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

fields

String, String[], Boolean — A comma-separated list of field names

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

includeUnmapped

Boolean — Indicates whether unmapped fields should be included in the response.

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

get

client.get([params, [callback]])

Get a typed JSON document from the index based on its id.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Get /myindex/mytype/1
const response = await client.get({
  index: 'myindex',
  type: 'mytype',
  id: 1
});

Params

storedFields

String, String[], Boolean — A comma-separated list of stored fields to return in the response

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

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

id

String — The document ID

index

String — The name of the index

type

String — The type of the document (use _all to fetch the first document matching the ID across all types)

getScript

client.getScript([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Specify timeout for connection to master

id

String — Script ID

getSource

client.getSource([params, [callback]])

Get the source of a document by its index, type and id.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

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

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

id

String — The document ID

index

String — The name of the index

type

String — The type of the document; deprecated and optional starting with 7.0

index

client.index([params, [callback]])

Stores a typed JSON document in an index, making it searchable. When the id param is not set, a unique id will be auto-generated. When you specify an id either a new document will be created, or an existing document will be updated. To enforce "put-if-absent" behavior set the opType to "create" or use the create() method.

Optimistic concurrency control is performed, when the version argument is specified. By default, no version checks are performed.

By default, the document will be available for get() actions immediately, but will only be available for searching after an index refresh (which can happen automatically or manually). See indices.refresh.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Create or update a document
const response = await client.index({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    title: 'Test 1',
    tags: ['y', 'z'],
    published: true,
  }
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

[opType=index]

String — Explicit operation type

Options
  • "index"

  • "create"

refresh

String — If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

Options
  • "true"

  • "false"

  • "wait_for"

  • ""

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

ifSeqNo

Number — only perform the index operation if the last operation that has changed the document has the specified sequence number

ifPrimaryTerm

Number — only perform the index operation if the last operation that has changed the document has the specified primary term

pipeline

String — The pipeline id to preprocess incoming documents with

id

String — Document ID

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

info

client.info([params, [callback]])

Get basic info from the current cluster.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

mget

client.mget([params, [callback]])

Get multiple documents based on an index, type (optional) and ids. The body required by mget can take two forms: an array of document locations, or an array of document ids.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

An array of doc locations. Useful for getting documents from different indices.
const response = await client.mget({
  body: {
    docs: [
      { _index: 'indexA', _type: 'typeA', _id: '1' },
      { _index: 'indexB', _type: 'typeB', _id: '1' },
      { _index: 'indexC', _type: 'typeC', _id: '1' }
    ]
  }
});
An array of ids. You must also specify the index and type that apply to all of the ids.
const response = await client.mget({
  index: 'myindex',
  type: 'mytype',
  body: {
    ids: [1, 2, 3]
  }
});

Params

storedFields

String, String[], Boolean — A comma-separated list of stored fields to return in the response

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

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

msearch

client.msearch([params, [callback]])

Execute several search requests within the same request.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Perform multiple different searches, the body is made up of meta/data pairs
const response = await client.msearch({
  body: [
    // match all query, on all indices and types
    {},
    { query: { match_all: {} } },

    // query_string query, on index/mytype
    { index: 'myindex', type: 'mytype' },
    { query: { query_string: { query: '"Test 1"' } } }
  ]
});

Params

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "query_and_fetch"

  • "dfs_query_then_fetch"

  • "dfs_query_and_fetch"

maxConcurrentSearches

Number — Controls the maximum number of concurrent searches the multi search api will execute

typedKeys

Boolean — Specify whether aggregation and suggester names should be prefixed by their respective types in the response

[preFilterShardSize=128]

Number — A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it’s rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.

[maxConcurrentShardRequests=5]

Number — The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests

restTotalHitsAsInt

Boolean — Indicates whether hits.total should be rendered as an integer or an object in the rest search response

[ccsMinimizeRoundtrips=true]

Boolean — Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

index

String, String[], Boolean — A comma-separated list of index names to use as default

type

String, String[], Boolean — A comma-separated list of document types to use as default

body

Object[], JSONLines — The request body, as either an array of objects or new-line delimited JSON objects. See the elasticsearch docs for details about what can be specified here.

msearchTemplate

client.msearchTemplate([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "query_and_fetch"

  • "dfs_query_then_fetch"

  • "dfs_query_and_fetch"

typedKeys

Boolean — Specify whether aggregation and suggester names should be prefixed by their respective types in the response

maxConcurrentSearches

Number — Controls the maximum number of concurrent searches the multi search api will execute

restTotalHitsAsInt

Boolean — Indicates whether hits.total should be rendered as an integer or an object in the rest search response

[ccsMinimizeRoundtrips=true]

Boolean — Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

index

String, String[], Boolean — A comma-separated list of index names to use as default

type

String, String[], Boolean — A comma-separated list of document types to use as default

body

Object[], JSONLines — The request body, as either an array of objects or new-line delimited JSON objects. See the elasticsearch docs for details about what can be specified here.

mtermvectors

client.mtermvectors([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ids

String, String[], Boolean — A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body

termStatistics

Boolean — Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

[fieldStatistics=true]

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 "params" or "docs".

fields

String, String[], Boolean — A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs".

[offsets=true]

Boolean — Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

[positions=true]

Boolean — Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

[payloads=true]

Boolean — Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".

preference

String — Specify the node or shard the operation should be performed on (default: 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".

realtime

Boolean — Specifies if requests are real-time as opposed to near-real-time (default: true).

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

index

String — The index in which the document resides.

type

String — The type of the document.

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

ping

client.ping([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

putScript

client.putScript([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

context

String — Script context

id

String — Script ID

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

rankEval

client.rankEval([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

reindex

client.reindex([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

refresh

Boolean — Should the effected indexes be refreshed?

[timeout=1m]

DurationString — Time each individual bulk request should wait for shards that are unavailable.

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

[waitForCompletion=true]

Boolean — Should the request should block until the reindex is complete.

requestsPerSecond

Number — The throttle to set on this request in sub-requests per second. -1 means no throttle.

[scroll=5m]

DurationString — Control how long to keep the search context alive

[slices=1]

Number — The number of slices this task should be divided into. Defaults to 1 meaning the task isn’t sliced into subtasks.

maxDocs

Number — Maximum number of documents to process (default: all documents)

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

reindexRethrottle

client.reindexRethrottle([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

requestsPerSecond

Number — The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

taskId

String — The task id to rethrottle

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

renderSearchTemplate

client.renderSearchTemplate([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

id

String — The id of the stored search template

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

scriptsPainlessExecute

client.scriptsPainlessExecute([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

scroll

client.scroll([params, [callback]])

Scroll a search request (retrieve the next set of results) after specifying the scroll parameter in a search() call.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Collect every title in the index that contains the word "test"
const allTitles = [];
const responseQueue = [];

// start things off by searching, setting a scroll timeout, and pushing
// our first response into the queue to be processed
await client.search({
  index: 'myindex',
  scroll: '30s', // keep the search results "scrollable" for 30 seconds
  source: ['title'], // filter the source to only include the title field
  q: 'title:test'
})

while (responseQueue.length) {
  const response = responseQueue.shift();

  // collect the titles from this response
  response.hits.hits.forEach(function (hit) {
    allTitles.push(hit.fields.title);
  });

  // check to see if we have collected all of the titles
  if (response.hits.total === allTitles.length) {
    console.log('every "test" title', allTitles);
    break
  }

  // get the next response if there are more titles to fetch
  responseQueue.push(
    await client.scroll({
      scrollId: response._scroll_id,
      scroll: '30s'
    })
  );
}

Params

scroll

DurationString — Specify how long a consistent view of the index should be maintained for scrolled search

scrollId

String — The scroll ID

restTotalHitsAsInt

Boolean — Indicates whether hits.total should be rendered as an integer or an object in the rest search response

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

client.search([params, [callback]])

Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either simple query strings in the q parameter, or by specifying a full request definition using the Elasticsearch Query DSL in the body parameter.

Tip
bodybuilder and elastic-builder can be used to make building query bodies easier.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Search with a simple query string query
const response = await client.search({
  index: 'myindex',
  q: 'title:test'
});
Passing a full request definition in the Elasticsearch’s Query DSL as a Hash
const response = await client.search({
  index: 'myindex',
  body: {
    query: {
      match: {
        title: 'test'
      }
    },
    facets: {
      tags: {
        terms: {
          field: 'tags'
        }
      }
    }
  }
});

Params

analyzer

String — The analyzer to use for the query string

analyzeWildcard

Boolean — Specify whether wildcard and prefix queries should be analyzed (default: false)

[ccsMinimizeRoundtrips=true]

Boolean — Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "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

storedFields

String, String[], Boolean — A comma-separated list of stored fields to return as part of a hit

docvalueFields

String, String[], Boolean — A comma-separated list of fields to return as the docvalue representation of a field for each hit

from

Number — Starting offset (default: 0)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

ignoreThrottled

Boolean — Whether specified concrete, expanded or aliased indices should be ignored when throttled

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

lenient

Boolean — Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

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, String[], Boolean — A comma-separated list of specific routing values

scroll

DurationString — Specify how long a consistent view of the index should be maintained for scrolled search

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "dfs_query_then_fetch"

size

Number — Number of hits to return (default: 10)

sort

String, String[], Boolean — A comma-separated list of <field>:<direction> pairs

_source

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

terminateAfter

Number — The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

stats

String, String[], Boolean — Specific 'tag' of the request for logging and statistical purposes

suggestField

String — Specify which field to use for suggestions

[suggestMode=missing]

String — Specify suggest mode

Options
  • "missing"

  • "popular"

  • "always"

suggestSize

Number — How many suggestions to return in response

suggestText

String — The source text for which the suggestions should be returned

timeout

DurationString — Explicit operation timeout

trackScores

Boolean — Whether to calculate and return scores even if they are not used for sorting

trackTotalHits

Boolean — Indicate if the number of documents that match the query should be tracked

[allowPartialSearchResults=true]

Boolean — Indicate if an error should be returned if there is a partial search failure or timeout

typedKeys

Boolean — Specify whether aggregation and suggester names should be prefixed by their respective types in the response

version

Boolean — Specify whether to return document version as part of a hit

seqNoPrimaryTerm

Boolean — Specify whether to return sequence number and primary term of the last modification of each hit

requestCache

Boolean — Specify if request cache should be used for this request or not, defaults to index level setting

[batchedReduceSize=512]

Number — The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.

[maxConcurrentShardRequests=5]

Number — The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests

[preFilterShardSize=128]

Number — A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it’s rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.

restTotalHitsAsInt

Boolean — Indicates whether hits.total should be rendered as an integer or an object in the rest search response

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

type

String, String[], Boolean — A comma-separated list of document types to search; leave empty to perform the operation on all types

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

searchShards

client.searchShards([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

preference

String — Specify the node or shard the operation should be performed on (default: random)

routing

String — Specific routing value

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

searchTemplate

client.searchTemplate([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

ignoreThrottled

Boolean — Whether specified concrete, expanded or aliased indices should be ignored when throttled

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

preference

String — Specify the node or shard the operation should be performed on (default: random)

routing

String, String[], Boolean — A comma-separated list of specific routing values

scroll

DurationString — Specify how long a consistent view of the index should be maintained for scrolled search

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "query_and_fetch"

  • "dfs_query_then_fetch"

  • "dfs_query_and_fetch"

explain

Boolean — Specify whether to return detailed information about score computation as part of a hit

profile

Boolean — Specify whether to profile the query execution

typedKeys

Boolean — Specify whether aggregation and suggester names should be prefixed by their respective types in the response

restTotalHitsAsInt

Boolean — Indicates whether hits.total should be rendered as an integer or an object in the rest search response

[ccsMinimizeRoundtrips=true]

Boolean — Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

type

String, String[], Boolean — A comma-separated list of document types to search; leave empty to perform the operation on all types

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

termvectors

client.termvectors([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

termStatistics

Boolean — Specifies if total term frequency and document frequency should be returned.

[fieldStatistics=true]

Boolean — Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.

fields

String, String[], Boolean — A comma-separated list of fields to return.

[offsets=true]

Boolean — Specifies if term offsets should be returned.

[positions=true]

Boolean — Specifies if term positions should be returned.

[payloads=true]

Boolean — Specifies if term payloads should be returned.

preference

String — Specify the node or shard the operation should be performed on (default: random).

routing

String — Specific routing value.

realtime

Boolean — Specifies if request is real-time as opposed to near-real-time (default: true).

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"

  • "external"

  • "external_gte"

  • "force"

index

String — The index in which the document resides.

type

String — The type of the document.

id

String — The id of the document, when not specified a doc param should be supplied.

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

update

client.update([params, [callback]])

Update parts of a document. The required body parameter can contain one of two things:

  • a partial document, which will be merged with the existing one.

  • a script which will update the document content

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Update document title using partial document
const response = await client.update({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    // put the partial document under the `doc` key
    doc: {
      title: 'Updated'
    }
  }
})
Add a tag to document tags property using a script
const response = await client.update({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    script: 'ctx._source.tags += tag',
    params: { tag: 'some new tag' }
  }
});
Increment a document counter by 1 or initialize it, when the document does not exist
const response = await client.update({
  index: 'myindex',
  type: 'mytype',
  id: '777',
  body: {
    script: 'ctx._source.counter += 1',
    upsert: {
      counter: 1
    }
  }
})
Delete a document if it’s tagged “to-delete”
const response = await client.update({
  index: 'myindex',
  type: 'mytype',
  id: '1',
  body: {
    script: 'ctx._source.tags.contains(tag) ? ctx.op = "delete" : ctx.op = "none"',
    params: {
      tag: 'to-delete'
    }
  }
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

_source

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

lang

String — The script language (default: painless)

refresh

String — If true then refresh the effected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

Options
  • "true"

  • "false"

  • "wait_for"

  • ""

retryOnConflict

Number — Specify how many times should the operation be retried when a conflict occurs (default: 0)

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

ifSeqNo

Number — only perform the update operation if the last operation that has changed the document has the specified sequence number

ifPrimaryTerm

Number — only perform the update operation if the last operation that has changed the document has the specified primary term

id

String — Document ID

index

String — The name of the index

type

String — The type of the document

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

updateByQuery

client.updateByQuery([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

analyzer

String — The analyzer to use for the query string

analyzeWildcard

Boolean — Specify whether wildcard and prefix queries should be analyzed (default: false)

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "AND"

  • "OR"

df

String — The field to use as default where no field prefix is given in the query string

from

Number — Starting offset (default: 0)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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=abort]

String — What to do when the update by query hits version conflicts?

Options
  • "abort"

  • "proceed"

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

lenient

Boolean — Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

pipeline

String — Ingest pipeline to set on index requests made by this action. (default: none)

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, String[], Boolean — A comma-separated list of specific routing values

scroll

DurationString — Specify how long a consistent view of the index should be maintained for scrolled search

searchType

String — Search operation type

Options
  • "query_then_fetch"

  • "dfs_query_then_fetch"

searchTimeout

DurationString — Explicit timeout for each search request. Defaults to no timeout.

size

Number — Deprecated, please use max_docs instead

maxDocs

Number — Maximum number of documents to process (default: all documents)

sort

String, String[], Boolean — A comma-separated list of <field>:<direction> pairs

_source

String, String[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

terminateAfter

Number — The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

stats

String, String[], Boolean — Specific 'tag' of the request for logging and statistical purposes

version

Boolean — Specify whether to return document version as part of a hit

versionType

Boolean — Should the document increment the version number (internal) on hit or not (reindex)

requestCache

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?

[timeout=1m]

DurationString — Time each individual bulk request should wait for shards that are unavailable.

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

scrollSize

Number — Size on the scroll request powering the update by query

[waitForCompletion=true]

Boolean — Should the request should block until the update by query operation is complete.

requestsPerSecond

Number — The throttle to set on this request in sub-requests per second. -1 means no throttle.

[slices=1]

Number — The number of slices this task should be divided into. Defaults to 1 meaning the task isn’t sliced into subtasks.

index

String, String[], Boolean — A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

type

String, String[], Boolean — A comma-separated list of document types to search; leave empty to perform the operation on all types

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

updateByQueryRethrottle

client.updateByQueryRethrottle([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

requestsPerSecond

Number — The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

taskId

String — The task id to rethrottle

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

cat.aliases

client.cat.aliases([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

name

String, String[], Boolean — A comma-separated list of alias names to return

cat.allocation

client.cat.allocation([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "kb"

  • "m"

  • "mb"

  • "g"

  • "gb"

  • "t"

  • "tb"

  • "p"

  • "pb"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information

cat.count

client.cat.count([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

index

String, String[], Boolean — A comma-separated list of index names to limit the returned information

cat.fielddata

client.cat.fielddata([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "kb"

  • "m"

  • "mb"

  • "g"

  • "gb"

  • "t"

  • "tb"

  • "p"

  • "pb"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

fields

String, String[], Boolean — A comma-separated list of fields to return the fielddata size

cat.health

client.cat.health([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

[ts=true]

Boolean — Set to false to disable timestamping

v

Boolean — Verbose mode. Display column headers

cat.help

client.cat.help([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

cat.indices

client.cat.indices([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "m"

  • "g"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

health

String — A health status ("green", "yellow", or "red" to filter only indices matching the specified health status

Options
  • "green"

  • "yellow"

  • "red"

help

Boolean — Return help information

pri

Boolean — Set to true to return stats only for primary shards

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

includeUnloadedSegments

Boolean — If set to true segment stats will include stats for segments that are not currently loaded into memory

index

String, String[], Boolean — A comma-separated list of index names to limit the returned information

cat.master

client.cat.master([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.nodeattrs

client.cat.nodeattrs([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.nodes

client.cat.nodes([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

fullId

Boolean — Return the full node ID instead of the shortened version (default: false)

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.pendingTasks

client.cat.pendingTasks([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.plugins

client.cat.plugins([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.recovery

client.cat.recovery([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "kb"

  • "m"

  • "mb"

  • "g"

  • "gb"

  • "t"

  • "tb"

  • "p"

  • "pb"

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

index

String, String[], Boolean — A comma-separated list of index names to limit the returned information

cat.repositories

client.cat.repositories([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.segments

client.cat.segments([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "kb"

  • "m"

  • "mb"

  • "g"

  • "gb"

  • "t"

  • "tb"

  • "p"

  • "pb"

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

index

String, String[], Boolean — A comma-separated list of index names to limit the returned information

cat.shards

client.cat.shards([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

bytes

String — The unit in which to display byte values

Options
  • "b"

  • "k"

  • "kb"

  • "m"

  • "mb"

  • "g"

  • "gb"

  • "t"

  • "tb"

  • "p"

  • "pb"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

index

String, String[], Boolean — A comma-separated list of index names to limit the returned information

cat.snapshots

client.cat.snapshots([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

ignoreUnavailable

Boolean — Set to true to ignore unavailable snapshots

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

repository

String, String[], Boolean — Name of repository from which to fetch the snapshot information

cat.tasks

client.cat.tasks([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

actions

String, String[], Boolean — A comma-separated list of actions that should be returned. Leave empty to return all.

detailed

Boolean — Return detailed task information (default: false)

parentTask

Number — Return tasks with specified parent task id. Set to -1 to return all.

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

cat.templates

client.cat.templates([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

name

String — A pattern that returned template names must match

cat.threadPool

client.cat.threadPool([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

format

String — a short version of the Accept header, e.g. json, yaml

size

String — The multiplier in which to display values

Options
  • ""

  • "k"

  • "m"

  • "g"

  • "t"

  • "p"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

h

String, String[], Boolean — Comma-separated list of column names to display

help

Boolean — Return help information

s

String, String[], Boolean — Comma-separated list of column names or column aliases to sort by

v

Boolean — Verbose mode. Display column headers

threadPoolPatterns

String, String[], Boolean — A comma-separated list of regular-expressions to filter the thread pools in the output

cluster.allocationExplain

client.cluster.allocationExplain([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeYesDecisions

Boolean — Return 'YES' decisions in explanation (default: false)

includeDiskInfo

Boolean — Return information about disk usage and shard sizes (default: false)

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

cluster.getSettings

client.cluster.getSettings([params, [callback]])

Get cluster settings (previously set with putSettings())

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flatSettings

Boolean — Return settings in flat format (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

includeDefaults

Boolean — Whether to return all default clusters setting.

cluster.health

client.cluster.health([params, [callback]])

Get a very simple status on the health of the cluster.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

[expandWildcards=all]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

[level=cluster]

String — Specify the level of detail for returned information

Options
  • "cluster"

  • "indices"

  • "shards"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

waitForActiveShards

String — Wait until the specified number of shards is active

waitForNodes

String — Wait until the specified number of nodes is available

waitForEvents

String — Wait until all currently queued events with the given priority are processed

Options
  • "immediate"

  • "urgent"

  • "high"

  • "normal"

  • "low"

  • "languid"

waitForNoRelocatingShards

Boolean — Whether to wait until there are no relocating shards in the cluster

waitForNoInitializingShards

Boolean — Whether to wait until there are no initializing shards in the cluster

waitForStatus

String — Wait until cluster is in a specific state

Options
  • "green"

  • "yellow"

  • "red"

index

String, String[], Boolean — Limit the information returned to a specific index

cluster.pendingTasks

client.cluster.pendingTasks([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Specify timeout for connection to master

cluster.putSettings

client.cluster.putSettings([params, [callback]])

Update cluster wide specific settings.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flatSettings

Boolean — Return settings in flat format (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

cluster.remoteInfo

client.cluster.remoteInfo([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

cluster.reroute

client.cluster.reroute([params, [callback]])

Explicitly execute a cluster reroute allocation command including specific commands.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

dryRun

Boolean — Simulate the operation only and return the resulting state

explain

Boolean — Return an explanation of why the commands can or cannot be executed

retryFailed

Boolean — Retries allocation of shards that are blocked due to too many subsequent allocation failures

metric

String, String[], Boolean — Limit the information returned to the specified metrics. Defaults to all but metadata

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

cluster.state

client.cluster.state([params, [callback]])

Get comprehensive details about the state of the whole cluster (indices settings, allocations, etc).

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

masterTimeout

DurationString — Specify timeout for connection to master

flatSettings

Boolean — Return settings in flat format (default: false)

waitForMetadataVersion

Number — Wait for the metadata version to be equal or greater than the specified metadata version

waitForTimeout

DurationString — The maximum time to wait for wait_for_metadata_version before timing out

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

metric

String, String[], Boolean — Limit the information returned to the specified metrics

cluster.stats

client.cluster.stats([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flatSettings

Boolean — Return settings in flat format (default: false)

timeout

DurationString — Explicit operation timeout

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

indices.analyze

client.indices.analyze([params, [callback]])

Perform the analysis process on a text and return the tokens breakdown of the text.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

index

String — The name of the index to scope the operation

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.clearCache

client.indices.clearCache([params, [callback]])

Clear either all caches or specific cached associated with one ore more indices.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

fielddata

Boolean — Clear field data

fields

String, String[], Boolean — A comma-separated list of fields to clear when using the fielddata parameter (default: all)

query

Boolean — Clear query caches

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index name to limit the operation

request

Boolean — Clear request cache

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.clone

client.indices.clone([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

waitForActiveShards

String — Set the number of active shards to wait for on the cloned index before the operation returns.

index

String — The name of the source index to clone

target

String — The name of the target index to clone into

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.close

client.indices.close([params, [callback]])

Close an index to remove its overhead from the cluster. Closed index is blocked for read/write operations.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

waitForActiveShards

String — Sets the number of active shards to wait for before the operation returns.

index

String, String[], Boolean — A comma separated list of indices to close

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.create

client.indices.create([params, [callback]])

Create an index in Elasticsearch.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be expected in the body of the mappings.

waitForActiveShards

String — Set the number of active shards to wait for before the operation returns.

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

index

String — The name of the index

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.delete

client.indices.delete([params, [callback]])

Delete an index in Elasticsearch

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

ignoreUnavailable

Boolean — Ignore unavailable indexes (default: false)

allowNoIndices

Boolean — Ignore if a wildcard expression resolves to no concrete indices (default: false)

[expandWildcards=open]

String — Whether wildcard expressions should get expanded to open or closed indices (default: open)

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of indices to delete; use _all or * string to delete all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.deleteAlias

client.indices.deleteAlias([params, [callback]])

Delete a specific alias.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit timestamp for the document

masterTimeout

DurationString — Specify timeout for connection to master

index

String, String[], Boolean — A comma-separated list of index names (supports wildcards); use _all for all indices

name

String, String[], Boolean — A comma-separated list of aliases to delete (supports wildcards); use _all to delete all aliases for the specified indices.

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.deleteTemplate

client.indices.deleteTemplate([params, [callback]])

Delete an index template by its name.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

name

String — The name of the template

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.exists

client.indices.exists([params, [callback]])

Return a boolean indicating whether given index exists.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

ignoreUnavailable

Boolean — Ignore unavailable indexes (default: false)

allowNoIndices

Boolean — Ignore if a wildcard expression resolves to no concrete indices (default: false)

[expandWildcards=open]

String — Whether wildcard expressions should get expanded to open or closed indices (default: open)

Options
  • "open"

  • "closed"

  • "none"

  • "all"

flatSettings

Boolean — Return settings in flat format (default: false)

includeDefaults

Boolean — Whether to return all default setting for each of the indices.

index

String, String[], Boolean — A comma-separated list of index names

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.existsAlias

client.indices.existsAlias([params, [callback]])

Return a boolean indicating whether given alias exists.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=all]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

index

String, String[], Boolean — A comma-separated list of index names to filter aliases

name

String, String[], Boolean — A comma-separated list of alias names to return

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.existsTemplate

client.indices.existsTemplate([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flatSettings

Boolean — Return settings in flat format (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

name

String, String[], Boolean — The comma separated names of the index templates

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.existsType

client.indices.existsType([params, [callback]])

Check if a type/types exists in an index/indices.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

index

String, String[], Boolean — A comma-separated list of index names; use _all to check the types across all indices

type

String, String[], Boolean — A comma-separated list of document types to check

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.flush

client.indices.flush([params, [callback]])

Explicitly flush one or more indices.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

force

Boolean — Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)

waitIfOngoing

Boolean — If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running.

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string for all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.flushSynced

client.indices.flushSynced([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string for all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.forcemerge

client.indices.forcemerge([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flush

Boolean — Specify whether the index should be flushed after performing the operation (default: true)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

maxNumSegments

Number — The number of segments the index should be merged into (default: dynamic)

onlyExpungeDeletes

Boolean — Specify whether the operation should only expunge deleted documents

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.get

client.indices.get([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether to add the type name to the response (default: false)

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

ignoreUnavailable

Boolean — Ignore unavailable indexes (default: false)

allowNoIndices

Boolean — Ignore if a wildcard expression resolves to no concrete indices (default: false)

[expandWildcards=open]

String — Whether wildcard expressions should get expanded to open or closed indices (default: open)

Options
  • "open"

  • "closed"

  • "none"

  • "all"

flatSettings

Boolean — Return settings in flat format (default: false)

includeDefaults

Boolean — Whether to return all default setting for each of the indices.

masterTimeout

DurationString — Specify timeout for connection to master

index

String, String[], Boolean — A comma-separated list of index names

indices.getAlias

client.indices.getAlias([params, [callback]])

Retrieve a specified alias.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=all]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

index

String, String[], Boolean — A comma-separated list of index names to filter aliases

name

String, String[], Boolean — A comma-separated list of alias names to return

indices.getFieldMapping

client.indices.getFieldMapping([params, [callback]])

Retrieve mapping definition of a specific field.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be returned in the body of the mappings.

includeDefaults

Boolean — Whether the default mapping values should be returned as well

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

index

String, String[], Boolean — A comma-separated list of index names

type

String, String[], Boolean — A comma-separated list of document types

fields

String, String[], Boolean — A comma-separated list of fields

indices.getMapping

client.indices.getMapping([params, [callback]])

Retrieve mapping definition of index or index/type.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether to add the type name to the response (default: false)

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

masterTimeout

DurationString — Specify timeout for connection to master

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

index

String, String[], Boolean — A comma-separated list of index names

type

String, String[], Boolean — A comma-separated list of document types

indices.getSettings

client.indices.getSettings([params, [callback]])

Retrieve settings for one or more (or all) indices.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Specify timeout for connection to master

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open,closed]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

flatSettings

Boolean — Return settings in flat format (default: false)

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

includeDefaults

Boolean — Whether to return all default setting for each of the indices.

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

name

String, String[], Boolean — The name of the settings that should be included

indices.getTemplate

client.indices.getTemplate([params, [callback]])

Retrieve an index template by its name.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be returned in the body of the mappings.

flatSettings

Boolean — Return settings in flat format (default: false)

masterTimeout

DurationString — Explicit operation timeout for connection to master node

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

name

String, String[], Boolean — The comma separated names of the index templates

indices.getUpgrade

client.indices.getUpgrade([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

indices.open

client.indices.open([params, [callback]])

Open a closed index, making it available for search.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=closed]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

waitForActiveShards

String — Sets the number of active shards to wait for before the operation returns.

index

String, String[], Boolean — A comma separated list of indices to open

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.putAlias

client.indices.putAlias([params, [callback]])

Create an alias for a specific index/indices.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit timestamp for the document

masterTimeout

DurationString — Specify timeout for connection to master

index

String, String[], Boolean — A comma-separated list of index names the alias should point to (supports wildcards); use _all to perform the operation on all indices.

name

String — The name of the alias to be created or updated

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.putMapping

client.indices.putMapping([params, [callback]])

Register specific mapping definition for a specific type.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be expected in the body of the mappings.

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices.

type

String — The name of the document type

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.putSettings

client.indices.putSettings([params, [callback]])

Change specific index level settings in real time.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Specify timeout for connection to master

timeout

DurationString — Explicit operation timeout

preserveExisting

Boolean — Whether to update existing settings. If set to true existing settings on an index remain unchanged, the default is false

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

flatSettings

Boolean — Return settings in flat format (default: false)

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.putTemplate

client.indices.putTemplate([params, [callback]])

Create an index template that will automatically be applied to new indices created.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be returned in the body of the mappings.

order

Number — The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)

create

Boolean — Whether the index template should only be added if new or can also replace an existing one

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

flatSettings

Boolean — Return settings in flat format (default: false)

name

String — The name of the template

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.recovery

client.indices.recovery([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

detailed

Boolean — Whether to display detailed information about shard recovery

activeOnly

Boolean — Display only those recoveries that are currently on-going

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

indices.refresh

client.indices.refresh([params, [callback]])

Explicitly refresh one or more index, making all operations performed since the last refresh available for search.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.rollover

client.indices.rollover([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

includeTypeName

Boolean — Whether a type should be included in the body of the mappings.

timeout

DurationString — Explicit operation timeout

dryRun

Boolean — If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false

masterTimeout

DurationString — Specify timeout for connection to master

waitForActiveShards

String — Set the number of active shards to wait for on the newly created rollover index before the operation returns.

alias

String — The name of the alias to rollover

newIndex

String — The name of the rollover index

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.segments

client.indices.segments([params, [callback]])

Retrieve low level segments information that a Lucene index (shard level) is built with.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

verbose

Boolean — Includes detailed memory usage by Lucene.

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

indices.shardStores

client.indices.shardStores([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

status

String, String[], Boolean — A comma-separated list of statuses used to filter on shards to get store information for

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

indices.shrink

client.indices.shrink([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

copySettings

Boolean — whether or not to copy settings from the source index (defaults to false)

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

waitForActiveShards

String — Set the number of active shards to wait for on the shrunken index before the operation returns.

index

String — The name of the source index to shrink

target

String — The name of the target index to shrink into

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.split

client.indices.split([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

copySettings

Boolean — whether or not to copy settings from the source index (defaults to false)

timeout

DurationString — Explicit operation timeout

masterTimeout

DurationString — Specify timeout for connection to master

waitForActiveShards

String — Set the number of active shards to wait for on the shrunken index before the operation returns.

index

String — The name of the source index to split

target

String — The name of the target index to split into

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.stats

client.indices.stats([params, [callback]])

Retrieve statistics on different operations happening on an index.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

completionFields

String, String[], Boolean — A comma-separated list of fields for fielddata and suggest index metric (supports wildcards)

fielddataFields

String, String[], Boolean — A comma-separated list of fields for fielddata index metric (supports wildcards)

fields

String, String[], Boolean — A comma-separated list of fields for fielddata and completion index metric (supports wildcards)

groups

String, String[], Boolean — A comma-separated list of search groups for search index metric

[level=indices]

String — Return stats aggregated at cluster, index or shard level

Options
  • "cluster"

  • "indices"

  • "shards"

types

String, String[], Boolean — A comma-separated list of document types for the indexing index metric

includeSegmentFileSizes

Boolean — Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)

includeUnloadedSegments

Boolean — If set to true segment stats will include stats for segments that are not currently loaded into memory

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

[forbidClosedIndices=true]

Boolean — If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

metric

String, String[], Boolean — Limit the information returned the specific metrics.

indices.updateAliases

client.indices.updateAliases([params, [callback]])

Update specified aliases.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Perform an atomic alias swap, for a rotating index
const response = await client.indices.updateAliases({
  body: {
    actions: [
      { remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
      { add:    { index: 'logstash-2014.05', alias: 'logstash-current' } }
    ]
  }
});

Params

timeout

DurationString — Request timeout

masterTimeout

DurationString — Specify timeout for connection to master

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.upgrade

client.indices.upgrade([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

waitForCompletion

Boolean — Specify whether the request should block until the all segments are upgraded (default: false)

onlyAncientSegments

Boolean — If true, only ancient (an older Lucene major release) segments will be upgraded

index

String, String[], Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

indices.validateQuery

client.indices.validateQuery([params, [callback]])

Validate a potentially expensive query without executing it.

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

explain

Boolean — Return detailed information about the error

ignoreUnavailable

Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)

allowNoIndices

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)

[expandWildcards=open]

String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

Options
  • "open"

  • "closed"

  • "none"

  • "all"

q

String — Query in the Lucene query string syntax

analyzer

String — The analyzer to use for the query string

analyzeWildcard

Boolean — Specify whether wildcard and prefix queries should be analyzed (default: false)

[defaultOperator=OR]

String — The default operator for query string query (AND or OR)

Options
  • "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

rewrite

Boolean — Provide a more detailed explanation showing the actual Lucene query that will be executed.

allShards

Boolean — Execute validation on all shards instead of one random shard per index

index

String, String[], Boolean — A comma-separated list of index names to restrict the operation; use _all or empty string to perform the operation on all indices

type

String, String[], Boolean — A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

ingest.deletePipeline

client.ingest.deletePipeline([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

id

String — Pipeline ID

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

ingest.getPipeline

client.ingest.getPipeline([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

id

String — Comma separated list of pipeline ids. Wildcards supported

ingest.processorGrok

client.ingest.processorGrok([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

ingest.putPipeline

client.ingest.putPipeline([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

id

String — Pipeline ID

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

ingest.simulate

client.ingest.simulate([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

verbose

Boolean — Verbose mode. Display data output for each processor in executed pipeline

id

String — Pipeline ID

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

nodes.hotThreads

client.nodes.hotThreads([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

interval

DurationString — The interval for the second sampling of threads

snapshots

Number — Number of samples of thread stacktrace (default: 10)

threads

Number — Specify the number of threads to provide information for (default: 3)

ignoreIdleThreads

Boolean — Don’t show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true)

type

String — The type to sample (default: cpu)

Options
  • "cpu"

  • "wait"

  • "block"

timeout

DurationString — Explicit operation timeout

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

nodes.info

client.nodes.info([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

flatSettings

Boolean — Return settings in flat format (default: false)

timeout

DurationString — Explicit operation timeout

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

metric

String, String[], Boolean — A comma-separated list of metrics you wish returned. Leave empty to return all.

nodes.reloadSecureSettings

client.nodes.reloadSecureSettings([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

nodeId

String, String[], Boolean — A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

nodes.stats

client.nodes.stats([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

completionFields

String, String[], Boolean — A comma-separated list of fields for fielddata and suggest index metric (supports wildcards)

fielddataFields

String, String[], Boolean — A comma-separated list of fields for fielddata index metric (supports wildcards)

fields

String, String[], Boolean — A comma-separated list of fields for fielddata and completion index metric (supports wildcards)

groups

Boolean — A comma-separated list of search groups for search index metric

[level=node]

String — Return indices stats aggregated at index, node or shard level

Options
  • "indices"

  • "node"

  • "shards"

types

String, String[], Boolean — A comma-separated list of document types for the indexing index metric

timeout

DurationString — Explicit operation timeout

includeSegmentFileSizes

Boolean — Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)

metric

String, String[], Boolean — Limit the information returned to the specified metrics

indexMetric

String, String[], Boolean — Limit the information returned for indices metric to the specific index metrics. Isn’t used if indices (or all) metric isn’t specified.

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

nodes.usage

client.nodes.usage([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

timeout

DurationString — Explicit operation timeout

metric

String, String[], Boolean — Limit the information returned to the specified metrics

nodeId

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

snapshot.create

client.snapshot.create([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

waitForCompletion

Boolean — Should this request wait until the operation has completed before returning

repository

String — A repository name

snapshot

String — A snapshot name

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

snapshot.createRepository

client.snapshot.createRepository([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

verify

Boolean — Whether to verify the repository after creation

repository

String — A repository name

body

Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

snapshot.delete

client.snapshot.delete([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

repository

String — A repository name

snapshot

String — A snapshot name

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

snapshot.deleteRepository

client.snapshot.deleteRepository([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

repository

String, String[], Boolean — A comma-separated list of repository names

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

snapshot.get

client.snapshot.get([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

ignoreUnavailable

Boolean — Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown

verbose

Boolean — Whether to show verbose snapshot info or only show the basic info found in the repository index blob

repository

String — A repository name

snapshot

String, String[], Boolean — A comma-separated list of snapshot names

snapshot.getRepository

client.snapshot.getRepository([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

local

Boolean — Return local information, do not retrieve the state from master node (default: false)

repository

String, String[], Boolean — A comma-separated list of repository names

snapshot.restore

client.snapshot.restore([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

waitForCompletion

Boolean — Should this request wait until the operation has completed before returning

repository

String — A repository name

snapshot

String — A snapshot name

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

snapshot.status

client.snapshot.status([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

ignoreUnavailable

Boolean — Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown

repository

String — A repository name

snapshot

String, String[], Boolean — A comma-separated list of snapshot names

snapshot.verifyRepository

client.snapshot.verifyRepository([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

masterTimeout

DurationString — Explicit operation timeout for connection to master node

timeout

DurationString — Explicit operation timeout

repository

String — A repository name

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

tasks.cancel

client.tasks.cancel([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

nodes

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

actions

String, String[], Boolean — A comma-separated list of actions that should be cancelled. Leave empty to cancel all.

parentTaskId

String — Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.

taskId

String — Cancel the task with specified task id (node_id:task_number)

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

tasks.get

client.tasks.get([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

waitForCompletion

Boolean — Wait for the matching tasks to complete (default: false)

timeout

DurationString — Explicit operation timeout

taskId

String — Return the task with specified id (node_id:task_number)

tasks.list

client.tasks.list([params, [callback]])

Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.

Params

nodes

String, String[], Boolean — A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

actions

String, String[], Boolean — A comma-separated list of actions that should be returned. Leave empty to return all.

detailed

Boolean — Return detailed task information (default: false)

parentTaskId

String — Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.

waitForCompletion

Boolean — Wait for the matching tasks to complete (default: false)

[groupBy=nodes]

String — Group tasks by nodes or parent/child relationships

Options
  • "nodes"

  • "parents"

  • "none"

timeout

DurationString — Explicit operation timeout