At this time, you must opt into the 2.4 API by setting the apiVersion
config parameter.
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
consistency
|
String — Explicit write consistency setting for the operation
|
refresh
|
Boolean — Refresh the index after performing the operation
|
routing
|
String — Specific routing value
|
timeout
|
DurationString — Explicit operation timeout
|
type
|
String — Default document type for items which don’t provide one
|
fields
|
String , String[] , Boolean — Default comma-separated list of fields to return in the response for updates
|
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.
|
back to top
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.
client.count(function (error, response, status) {
// check for and handle error
var count = response.count;
});
Get the number of documents in an index.
client.count({
index: 'index_name'
}, function (error, response) {
// ...
});
Get the number of documents matching a query.
client.count({
index: 'index_name',
body: {
query: {
filtered: {
filter: {
terms: {
foo: ['bar']
}
}
}
}
}
}, function (err, response) {
// ...
});
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"
|
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 — Specific routing value
|
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)
|
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
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
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.
|
back to top
client.countPercolate([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
routing
|
String , String[] , Boolean — A comma-separated list of specific routing values
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
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"
|
percolateIndex
|
String — The index to count percolate the document into. Defaults to index.
|
percolateType
|
String — The type to count percolate document into. Defaults to type.
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
index
|
String — The index of the document being count percolated.
|
type
|
String — The type of the document being count percolated.
|
id
|
String — Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
|
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.
|
back to top
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.
client.create({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
published_at: '2013-01-01',
counter: 1
}
}, function (error, response) {
// ...
});
Params
consistency
|
String — Explicit write consistency setting for the operation
|
parent
|
String — ID of the parent document
|
refresh
|
Boolean — Refresh the affected shards after performing the operation
|
routing
|
String — Specific routing value
|
timeout
|
DurationString — Explicit operation timeout
|
timestamp
|
Timestamp — Explicit timestamp for the document
|
ttl
|
DurationString — Expiration time for the document
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
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.
|
back to top
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
.
client.delete({
index: 'myindex',
type: 'mytype',
id: '1'
}, function (error, response) {
// ...
});
Params
consistency
|
String — Specific write consistency setting for the operation
|
parent
|
String — ID of parent document
|
refresh
|
Boolean — Refresh the index after performing the operation
|
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"
|
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.
|
back to top
client.deleteScript([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Script ID
|
lang
|
String — Script language
|
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.
|
back to top
client.deleteTemplate([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Template 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.
|
back to top
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.
client.exists({
index: 'myindex',
type: 'mytype',
id: 1
}, function (error, exists) {
if (exists === true) {
// ...
} else {
// ...
}
});
Params
parent
|
String — The ID of the parent document
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
realtime
|
Boolean — Specify whether to perform the operation in realtime or search mode
|
refresh
|
Boolean — Refresh the shard containing the document before performing the operation
|
routing
|
String — Specific routing value
|
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.
|
back to top
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. Also check out percolaters.
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.
client.explain({
// the document to test
index: 'myindex',
type: 'mytype',
id: '1',
// the query to score it against
q: 'field:value'
}, function (error, response) {
// ...
});
See how a document is scored against a query written in the Query DSL.
client.explain({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
query: {
match: { title: 'test' }
}
}
}, function (error, response) {
// ...
});
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)
|
df
|
String — The default field for query string query (default: _all)
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to return in the response
|
lenient
|
Boolean — Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
parent
|
String — The ID of the parent document
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
q
|
String — Query in the Lucene query string syntax
|
routing
|
String — Specific routing value
|
_source
|
String , String[] , Boolean — True or false to return the _source field or not, or a list of fields to return
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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.
|
back to top
client.fieldStats([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 fields for to get field statistics for (min value, max value, and more)
|
[level=cluster]
|
String — Defines if field stats should be returned on a per index level or on a cluster wide level
|
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.
|
back to top
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
.
client.get({
index: 'myindex',
type: 'mytype',
id: 1
}, function (error, response) {
// ...
});
Params
fields
|
String , String[] , Boolean — A comma-separated list of fields to return in the response
|
parent
|
String — The ID of the parent document
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
realtime
|
Boolean — Specify whether to perform the operation in realtime or search mode
|
refresh
|
Boolean — Refresh the shard containing the document before performing the operation
|
routing
|
String — Specific routing value
|
_source
|
String , String[] , Boolean — True or false to return the _source field or not, or a list of fields to return
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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)
|
back to top
client.getScript([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Script ID
|
lang
|
String — Script language
|
back to top
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
parent
|
String — The ID of the parent document
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
realtime
|
Boolean — Specify whether to perform the operation in realtime or search mode
|
refresh
|
Boolean — Refresh the shard containing the document before performing the operation
|
routing
|
String — Specific routing value
|
_source
|
String , String[] , Boolean — True or false to return the _source field or not, or a list of fields to return
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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
|
back to top
client.getTemplate([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Template ID
|
back to top
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.
client.index({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
}
}, function (error, response) {
});
Params
consistency
|
String — Explicit write consistency setting for the operation
|
[opType=index]
|
String — Explicit operation type
|
parent
|
String — ID of the parent document
|
refresh
|
Boolean — Refresh the affected shards after performing the operation
|
routing
|
String — Specific routing value
|
timeout
|
DurationString — Explicit operation timeout
|
timestamp
|
Timestamp — Explicit timestamp for the document
|
ttl
|
DurationString — Expiration time for the document
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
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.
|
back to top
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.
client.mget({
body: {
docs: [
{ _index: 'indexA', _type: 'typeA', _id: '1' },
{ _index: 'indexB', _type: 'typeB', _id: '1' },
{ _index: 'indexC', _type: 'typeC', _id: '1' }
]
}
}, function(error, response){
// ...
});
An array of ids. You must also specify the index
and type
that apply to all of the ids.
client.mget({
index: 'myindex',
type: 'mytype',
body: {
ids: [1, 2, 3]
}
}, function(error, response){
// ...
});
Params
fields
|
String , String[] , Boolean — A comma-separated list of 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
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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.
|
back to top
client.mpercolate([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 — The index of the document being count percolated to use as default
|
type
|
String — The type of the document being percolated to use as default.
|
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.
|
back to top
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.
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"
-
"count"
-
"scan"
|
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.
|
back to top
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".
|
parent
|
String — Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs".
|
realtime
|
Boolean — Specifies if requests are real-time as opposed to near-real-time (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.
|
back to top
client.percolate([params, [callback]])
Match a document against registered percolator queries.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
First, Register queries named “alert-1” and “alert-2” for the “myindex” index.
client.index({
index: 'myindex',
type: '.percolator',
id: 'alert-1',
body: {
// This query will be run against documents sent to percolate
query: {
query_string: {
query: 'foo'
}
}
}
}, function (error, response) {
// ...
});
client.index({
index: 'myindex',
type: '.percolator',
id: 'alert-2',
body: {
// This query will also be run against documents sent to percolate
query: {
query_string: {
query: 'bar'
}
}
}
}, function (error, response) {
// ...
});
Then you can send documents to learn which query _percolator
queries they match.
client.percolate({
index: 'myindex',
type: 'mytype',
body: {
doc: {
title: "Foo"
}
}
}, function (error, response) {
// response would equal
// {
// total: 1,
// matches: [ { _index: 'myindex', _id: 'alert-1' } ]
// }
});
client.percolate({
index: 'myindex',
type: 'mytype',
body: {
doc: {
title: "Foo Bar"
}
}
}, function (error, response) {
// response would equal
// {
// total: 2,
// matches: [
// { _index: 'myindex', _id: 'alert-1' },
// { _index: 'myindex', _id: 'alert-2' }
// ]
// }
});
Params
routing
|
String , String[] , Boolean — A comma-separated list of specific routing values
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
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"
|
percolateIndex
|
String — The index to percolate the document into. Defaults to index.
|
percolateType
|
String — The type to percolate document into. Defaults to type.
|
percolateRouting
|
String — The routing value to use when percolating the existing document.
|
percolatePreference
|
String — Which shard to prefer when executing the percolate request.
|
percolateFormat
|
String — Return an array of matching query IDs instead of objects
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
index
|
String — The index of the document being percolated.
|
type
|
String — The type of the document being percolated.
|
id
|
String — Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
|
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.
|
back to top
client.putScript([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
[opType=index]
|
String — Explicit operation type
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Script ID
|
lang
|
String — Script language
|
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.
|
back to top
client.putTemplate([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
[opType=index]
|
String — Explicit operation type
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
-
Options
-
"internal"
-
"external"
-
"external_gte"
-
"force"
|
id
|
String — Template 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.
|
back to top
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.
|
consistency
|
String — Explicit write consistency setting for the operation
|
waitForCompletion
|
Boolean — Should the request should block until the reindex is complete.
|
requestsPerSecond
|
Number — The throttle for this request in sub-requests per second. 0 means set no throttle.
|
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.
|
back to top
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 sub-requests per second. 0 means set no throttle. As does "unlimited". Otherwise it must be a float.
|
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.
|
back to top
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".
var allTitles = [];
// first we do a search, and specify a scroll timeout
client.search({
index: 'myindex',
// Set to 30 seconds because we are calling right back
scroll: '30s',
search_type: 'scan',
fields: ['title'],
q: 'title:test'
}, function getMoreUntilDone(error, response) {
// collect the title from each response
response.hits.hits.forEach(function (hit) {
allTitles.push(hit.fields.title);
});
if (response.hits.total !== allTitles.length) {
// now we can call scroll over and over
client.scroll({
scrollId: response._scroll_id,
scroll: '30s'
}, getMoreUntilDone);
} else {
console.log('every "test" title', allTitles);
}
});
Params
scroll
|
DurationString — Specify how long a consistent view of the index should be maintained for scrolled search
|
scrollId
|
String — The scroll 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.
|
back to top
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.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Search with a simple query string query.
client.search({
index: 'myindex',
q: 'title:test'
}, function (error, response) {
// ...
});
Passing a full request definition in the Elasticsearch’s Query DSL as a Hash
.
client.search({
index: 'myindex',
body: {
query: {
match: {
title: 'test'
}
},
facets: {
tags: {
terms: {
field: 'tags'
}
}
}
}
}, function (error, response) {
// ...
});
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)
|
df
|
String — The field to use as default where no field prefix is given in the query string
|
explain
|
Boolean — Specify whether to return detailed information about score computation as part of a hit
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to return as part of a hit
|
fielddataFields
|
String , String[] , Boolean — A comma-separated list of fields to return as the field data 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)
|
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
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
q
|
String — Query in the Lucene query string syntax
|
routing
|
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"
-
"count"
-
"scan"
|
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
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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
|
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
|
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.
|
back to top
client.searchExists([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"
|
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 — Specific routing value
|
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)
|
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
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
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.
|
back to top
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
|
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.
|
back to top
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)
|
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"
-
"count"
-
"scan"
|
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.
|
back to top
client.suggest([params, [callback]])
The suggest feature suggests similar looking terms based on a provided text by using a specific suggester.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Return query terms suggestions (“auto-correction”).
client.suggest({
index: 'myindex',
body: {
mysuggester: {
text: 'tset',
term: {
field: 'title'
}
}
}
}, function (error, response) {
// response will be formatted like so:
//
// {
// ...
// mysuggester: [
// {
// text: "tset",
// ...
// options: [
// {
// text: "test",
// score: 0.75,
// freq: 5
// }
// ]
// }
// ]
// }
});
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"
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
routing
|
String — Specific routing value
|
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
|
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.
|
back to top
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.
|
dfs
|
Boolean — Specifies if distributed frequencies should be returned instead shard frequencies.
|
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.
|
parent
|
String — Parent id of documents.
|
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.
|
back to top
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.
client.update({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
// put the partial document under the `doc` key
doc: {
title: 'Updated'
}
}
}, function (error, response) {
// ...
})
Add a tag to document tags
property using a script
.
client.update({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
script: 'ctx._source.tags += tag',
params: { tag: 'some new tag' }
}
}, function (error, response) {
// ...
});
Increment a document counter by 1 or initialize it, when the document does not exist.
client.update({
index: 'myindex',
type: 'mytype',
id: '777',
body: {
script: 'ctx._source.counter += 1',
upsert: {
counter: 1
}
}
}, function (error, response) {
// ...
})
Delete a document if it’s tagged “to-delete”.
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'
}
}
}, function (error, response) {
// ...
});
Params
consistency
|
String — Explicit write consistency setting for the operation
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to return in the response
|
lang
|
String — The script language (default: groovy)
|
parent
|
String — ID of the parent document. Is is only used for routing and when for the upsert request
|
refresh
|
Boolean — Refresh the index after performing the operation
|
retryOnConflict
|
Number — Specify how many times should the operation be retried when a conflict occurs (default: 0)
|
routing
|
String — Specific routing value
|
script
|
String — The URL-encoded script definition (instead of using request body)
|
scriptId
|
String — The id of a stored script
|
scriptedUpsert
|
Boolean — True if the script referenced in script or script_id should be called to perform inserts - defaults to false
|
timeout
|
DurationString — Explicit operation timeout
|
timestamp
|
Timestamp — Explicit timestamp for the document
|
ttl
|
DurationString — Expiration time for the document
|
version
|
Number — Explicit version number for concurrency control
|
versionType
|
String — Specific version type
|
id
|
String — 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.
|
back to top
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)
|
df
|
String — The field to use as default where no field prefix is given in the query string
|
explain
|
Boolean — Specify whether to return detailed information about score computation as part of a hit
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to return as part of a hit
|
fielddataFields
|
String , String[] , Boolean — A comma-separated list of fields to return as the field data 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)
|
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 reindex hits version conflicts?
|
[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
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
preference
|
String — Specify the node or shard the operation should be performed on (default: random)
|
q
|
String — Query in the Lucene query string syntax
|
routing
|
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 — 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
|
_sourceExclude
|
String , String[] , Boolean — A list of fields to exclude from the returned _source field
|
_sourceInclude
|
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=1m]
|
DurationString — Time each individual bulk request should wait for shards that are unavailable.
|
trackScores
|
Boolean — Whether to calculate and return scores even if they are not used for sorting
|
version
|
Boolean — Specify whether to return document version as part of a hit
|
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?
|
consistency
|
String — Explicit write consistency setting for the operation
|
scrollSize
|
Number — Size on the scroll request powering the update_by_query
|
waitForCompletion
|
Boolean — Should the request should block until the reindex is complete.
|
requestsPerSecond
|
Number — The throttle for this request in sub-requests per second. 0 means set no throttle.
|
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.
|
back to top
client.cat.allocation([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
bytes
|
String — The unit in which to display byte values
|
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
|
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
|
back to top
client.cat.fielddata([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
bytes
|
String — The unit in which to display byte values
|
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
|
v
|
Boolean — Verbose mode. Display column headers
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to return the fielddata size
|
back to top
client.cat.health([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 — 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
|
[ts=true]
|
Boolean — Set to false to disable timestamping
|
v
|
Boolean — Verbose mode. Display column headers
|
back to top
client.cat.indices([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
bytes
|
String — The unit in which to display byte values
|
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
|
pri
|
Boolean — Set to true to return stats only for primary shards
|
v
|
Boolean — Verbose mode. Display column headers
|
index
|
String , String[] , Boolean — A comma-separated list of index names to limit the returned information
|
back to top
client.cat.threadPool([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 — 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
|
v
|
Boolean — Verbose mode. Display column headers
|
fullId
|
Boolean — Enables displaying the complete node ids
|
back to top
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
|
back to top
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
[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
|
Number — Wait until the specified number of shards is active
|
waitForNodes
|
String — Wait until the specified number of nodes is available
|
waitForRelocatingShards
|
Number — Wait until the specified number of relocating shards is finished
|
waitForStatus
|
String — Wait until cluster is in a specific state
|
index
|
String , String[] , Boolean — Limit the information returned to a specific index
|
back to top
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 — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.
|
back to top
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
|
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.
|
back to top
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)
|
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
|
back to top
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)
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
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
|
back to top
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
analyzer
|
String — The name of the analyzer to use
|
charFilters
|
String , String[] , Boolean — Deprecated : A comma-separated list of character filters to use for the analysis
|
charFilter
|
String , String[] , Boolean — A comma-separated list of character filters to use for the analysis
|
field
|
String — Use the analyzer configured for this field (instead of passing the analyzer name)
|
filters
|
String , String[] , Boolean — Deprecated : A comma-separated list of filters to use for the analysis
|
filter
|
String , String[] , Boolean — A comma-separated list of filters to use for the analysis
|
index
|
String — The name of the index to scope the operation
|
preferLocal
|
Boolean — With true , specify that a local shard should be used if available, with false , use a random shard (default: true)
|
text
|
String , String[] , Boolean — The text on which the analysis should be performed (when request body is not used)
|
tokenizer
|
String — The name of the tokenizer to use for the analysis
|
explain
|
Boolean — With true , outputs more advanced details. (default: false)
|
attributes
|
String , String[] , Boolean — A comma-separated list of token attributes to output, this parameter works only with explain=true
|
[format=detailed]
|
String — Format of the output
|
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.
|
back to top
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
|
fielddata
|
Boolean — Clear field data
|
fields
|
String , String[] , Boolean — A comma-separated list of fields to clear when using the field_data 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
|
recycler
|
Boolean — Clear the recycler cache
|
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.
|
back to top
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"
|
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.
|
back to top
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
timeout
|
DurationString — Explicit operation timeout
|
masterTimeout
|
DurationString — Specify timeout for connection to master
|
updateAllTypes
|
Boolean — Whether to update the mapping for all fields with the same name across all types or not
|
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.
|
back to top
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.
|
back to top
client.indices.deleteWarmer([params, [callback]])
Delete an index warmer.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
DurationString — Specify timeout for connection to master
|
name
|
String , String[] , Boolean — A comma-separated list of warmer names to delete (supports wildcards); use _all to delete all warmers in the specified indices. You must specify a name either in the uri or in the parameters.
|
index
|
String , String[] , Boolean — A comma-separated list of index names to delete warmers from (supports wildcards); use _all 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.
|
back to top
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
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 indices 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.
|
back to top
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=open,closed]
|
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.
|
back to top
indices.existsTemplate
edit
client.indices.existsTemplate([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)
|
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.
|
back to top
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.
|
back to top
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 false and will cause an exception to be thrown on the shard level 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.
|
back to top
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.
|
back to top
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
|
operationThreading
|
anything — TODO: ?
|
waitForMerge
|
Boolean — Specify whether the request should block until the merge process is finished (default: true)
|
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.
|
back to top
client.indices.get([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)
|
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)
|
human
|
Boolean — Whether to return version and creation date values in human-readable format.
|
index
|
String , String[] , Boolean — A comma-separated list of index names
|
feature
|
String , String[] , Boolean — A comma-separated list of features
|
back to top
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=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 to filter aliases
|
name
|
String , String[] , Boolean — A comma-separated list of alias names to return
|
back to top
indices.getFieldMapping
edit
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
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
|
back to top
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
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
|
back to top
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
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)
|
human
|
Boolean — Whether to return version and creation date values in human-readable format.
|
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
|
back to top
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
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
|
back to top
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"
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
index
|
String , String[] , Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices
|
back to top
client.indices.getWarmer([params, [callback]])
Retreieve an index warmer.
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 to restrict the operation; use _all to perform the operation on all indices
|
name
|
String , String[] , Boolean — The name of the warmer (supports wildcards); leave empty to get all warmers
|
type
|
String , String[] , Boolean — A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types
|
back to top
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"
|
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.
|
back to top
client.indices.optimize([params, [callback]])
Explicitly optimize one or more indices.
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
|
operationThreading
|
anything — TODO: ?
|
waitForMerge
|
Boolean — Specify whether the request should block until the merge process is finished (default: true)
|
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.
|
back to top
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.
|
back to top
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
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"
|
updateAllTypes
|
Boolean — Whether to update the mapping for all fields with the same name across all types or not
|
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.
|
back to top
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
|
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.
|
back to top
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
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.
|
back to top
client.indices.putWarmer([params, [callback]])
Create an index warmer to run registered search requests to warm up the index before it is available for search.
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) in the search request to warm
|
allowNoIndices
|
Boolean — Whether to ignore if a wildcard indices expression resolves into no concrete indices in the search request to warm. (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, in the search request to warm.
-
Options
-
"open"
-
"closed"
-
"none"
-
"all"
|
requestCache
|
Boolean — Specify whether the request to be warmed should use the request cache, defaults to index level setting
|
index
|
String , String[] , Boolean — A comma-separated list of index names to register the warmer for; use _all or omit to perform the operation on all indices
|
name
|
String — The name of the warmer
|
type
|
String , String[] , Boolean — A comma-separated list of document types to register the warmer for; 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.
|
back to top
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
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
index
|
String , String[] , Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices
|
back to top
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"
|
force
|
Boolean — Force a refresh even if not required
|
operationThreading
|
anything — TODO: ?
|
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.
|
back to top
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"
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
operationThreading
|
anything — TODO: ?
|
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
|
back to top
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"
|
operationThreading
|
anything — TODO: ?
|
index
|
String , String[] , Boolean — A comma-separated list of index names; use _all or empty string to perform the operation on all indices
|
back to top
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
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
[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
|
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.
|
back to top
indices.updateAliases
edit
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.
client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
}).then(function (response) {
// ...
}, errorHandler);
Params
back to top
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.
|
back to top
indices.validateQuery
edit
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"
|
operationThreading
|
anything — TODO: ?
|
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)
|
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
|
lowercaseExpandedTerms
|
Boolean — Specify whether query terms should be lowercased
|
rewrite
|
Boolean — Provide a more detailed explanation showing the actual Lucene query that will be executed.
|
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.
|
back to top
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)
|
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
|
back to top
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)
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
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.
|
back to top
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
|
human
|
Boolean — Whether to return time and byte values in human-readable format.
|
[level=node]
|
String — Return indices stats aggregated at node, index or shard level
-
Options
-
"node"
-
"indices"
-
"shards"
|
types
|
String , String[] , Boolean — A comma-separated list of document types for the indexing index metric
|
timeout
|
DurationString — Explicit operation timeout
|
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
|
back to top
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.
|
back to top
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.
|
back to top
client.tasks.cancel([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
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 cancelled. Leave empty to cancel all.
|
parentNode
|
String — Cancel tasks with specified parent node.
|
parentTask
|
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 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.
|
back to top
client.tasks.list([params, [callback]])
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Params
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)
|
parentNode
|
String — Return tasks with specified parent node.
|
parentTask
|
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)
|
taskId
|
String — Return the task with specified id (node_id:task_number)
|
back to top