Note
|
This is currently the default API, but in upcoming versions that will change. We recommend setting the apiVersion config param when you instantiate your client to make sure that the API does not change unexpectedly.
|
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.
client.bulk({
body: [
// action description
{ index: { _index: 'myindex', _type: 'mytype', _id: 1 } },
// the document to index
{ title: 'foo' },
// action description
{ update: { _index: 'myindex', _type: 'mytype', _id: 2 } },
// the document to update
{ doc: { title: 'foo' } },
// action description
{ delete: { _index: 'myindex', _type: 'mytype', _id: 3 } },
// no document needed for this delete
]
}, function (err, resp) {
// ...
});
Params
waitForActiveShards
|
|
refresh
|
|
routing
|
|
timeout
|
|
type
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
pipeline
|
|
index
|
|
body
|
|
client.clearScroll([params, [callback]])
Clear the scroll request created by specifying the scroll parameter to search.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
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.
const { count } = await client.count();
const { count } = await client.count({
index: 'index_name'
});
const { count } = await client.count({
index: 'index_name',
body: {
query: {
filtered: {
filter: {
terms: {
foo: ['bar']
}
}
}
}
}
});
Params
ignoreUnavailable
|
|
ignoreThrottled
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
minScore
|
|
preference
|
|
routing
|
|
q
|
|
analyzer
|
|
analyzeWildcard
|
|
[defaultOperator=OR]
|
|
df
|
|
lenient
|
|
terminateAfter
|
|
index
|
|
type
|
|
body
|
|
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.
await client.create({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
published_at: '2013-01-01',
counter: 1
}
});
Params
waitForActiveShards
|
|
refresh
|
|
routing
|
|
timeout
|
|
version
|
|
versionType
|
|
pipeline
|
|
id
|
|
index
|
|
type
|
|
body
|
|
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.
/myindex/mytype/1
await client.delete({
index: 'myindex',
type: 'mytype',
id: '1'
});
Params
waitForActiveShards
|
|
refresh
|
|
routing
|
|
timeout
|
|
ifSeqNo
|
|
ifPrimaryTerm
|
|
version
|
|
versionType
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.deleteByQuery([params, [callback]])
Delete documents from one or more indices and one or more types based on a query.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
await client.deleteByQuery({
index: 'myindex',
q: 'test'
});
await client.deleteByQuery({
index: 'posts',
body: {
query: {
term: { published: false }
}
}
});
Params
analyzer
|
|
analyzeWildcard
|
|
[defaultOperator=OR]
|
|
df
|
|
from
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[conflicts=abort]
|
|
[expandWildcards=open]
|
|
lenient
|
|
preference
|
|
q
|
|
routing
|
|
scroll
|
|
searchType
|
|
searchTimeout
|
|
size
|
|
maxDocs
|
|
sort
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
terminateAfter
|
|
stats
|
|
version
|
|
requestCache
|
|
refresh
|
|
[timeout=1m]
|
|
waitForActiveShards
|
|
scrollSize
|
|
[waitForCompletion=true]
|
|
requestsPerSecond
|
|
[slices=1]
|
|
index
|
|
type
|
|
body
|
|
client.deleteByQueryRethrottle([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
requestsPerSecond
|
|
taskId
|
|
body
|
|
client.deleteScript([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
masterTimeout
|
|
id
|
|
body
|
|
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.
/myindex/mytype/1
existconst exists = await client.exists({
index: 'myindex',
type: 'mytype',
id: 1
});
Params
storedFields
|
|
preference
|
|
realtime
|
|
refresh
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
version
|
|
versionType
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.existsSource([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
preference
|
|
realtime
|
|
refresh
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
version
|
|
versionType
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.explain([params, [callback]])
Provides details about a specific document’s score in relation to a specific query. It will also tell you if the document matches the specified query.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
const response = await client.explain({
// the document to test
index: 'myindex',
type: 'mytype',
id: '1',
// the query to score it against
q: 'field:value'
});
const response = await client.explain({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
query: {
match: { title: 'test' }
}
}
});
Params
analyzeWildcard
|
|
analyzer
|
|
[defaultOperator=OR]
|
|
df
|
|
storedFields
|
|
lenient
|
|
preference
|
|
q
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.fieldCaps([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
fields
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
includeUnmapped
|
|
index
|
|
body
|
|
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.
/myindex/mytype/1
const response = await client.get({
index: 'myindex',
type: 'mytype',
id: 1
});
Params
storedFields
|
|
preference
|
|
realtime
|
|
refresh
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
version
|
|
versionType
|
|
id
|
|
index
|
|
type
|
|
client.getScript([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
id
|
|
client.getSource([params, [callback]])
Get the source of a document by its index, type and id.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
preference
|
|
realtime
|
|
refresh
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
version
|
|
versionType
|
|
id
|
|
index
|
|
type
|
|
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.
const response = await client.index({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
}
});
Params
waitForActiveShards
|
|
[opType=index]
|
|
refresh
|
|
routing
|
|
timeout
|
|
version
|
|
versionType
|
|
ifSeqNo
|
|
ifPrimaryTerm
|
|
pipeline
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.info([params, [callback]])
Get basic info from the current cluster.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
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.
const response = await client.mget({
body: {
docs: [
{ _index: 'indexA', _type: 'typeA', _id: '1' },
{ _index: 'indexB', _type: 'typeB', _id: '1' },
{ _index: 'indexC', _type: 'typeC', _id: '1' }
]
}
});
index
and type
that apply to all of the ids.const response = await client.mget({
index: 'myindex',
type: 'mytype',
body: {
ids: [1, 2, 3]
}
});
Params
storedFields
|
|
preference
|
|
realtime
|
|
refresh
|
|
routing
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
index
|
|
type
|
|
body
|
|
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.
const response = await client.msearch({
body: [
// match all query, on all indices and types
{},
{ query: { match_all: {} } },
// query_string query, on index/mytype
{ index: 'myindex', type: 'mytype' },
{ query: { query_string: { query: '"Test 1"' } } }
]
});
Params
searchType
|
|
maxConcurrentSearches
|
|
typedKeys
|
|
[preFilterShardSize=128]
|
|
[maxConcurrentShardRequests=5]
|
|
restTotalHitsAsInt
|
|
[ccsMinimizeRoundtrips=true]
|
|
index
|
|
type
|
|
body
|
|
client.msearchTemplate([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
searchType
|
|
typedKeys
|
|
maxConcurrentSearches
|
|
restTotalHitsAsInt
|
|
[ccsMinimizeRoundtrips=true]
|
|
index
|
|
type
|
|
body
|
|
client.mtermvectors([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
ids
|
|
termStatistics
|
|
[fieldStatistics=true]
|
|
fields
|
|
[offsets=true]
|
|
[positions=true]
|
|
[payloads=true]
|
|
preference
|
|
routing
|
|
realtime
|
|
version
|
|
versionType
|
|
index
|
|
type
|
|
body
|
|
client.ping([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
client.putScript([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
masterTimeout
|
|
context
|
|
id
|
|
body
|
|
client.rankEval([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
client.reindex([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
refresh
|
|
[timeout=1m]
|
|
waitForActiveShards
|
|
[waitForCompletion=true]
|
|
requestsPerSecond
|
|
[scroll=5m]
|
|
[slices=1]
|
|
maxDocs
|
|
body
|
|
client.reindexRethrottle([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
requestsPerSecond
|
|
taskId
|
|
body
|
|
client.renderSearchTemplate([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
id
|
|
body
|
|
client.scriptsPainlessExecute([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
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.
const allTitles = [];
const responseQueue = [];
// start things off by searching, setting a scroll timeout, and pushing
// our first response into the queue to be processed
await client.search({
index: 'myindex',
scroll: '30s', // keep the search results "scrollable" for 30 seconds
source: ['title'], // filter the source to only include the title field
q: 'title:test'
})
while (responseQueue.length) {
const response = responseQueue.shift();
// collect the titles from this response
response.hits.hits.forEach(function (hit) {
allTitles.push(hit.fields.title);
});
// check to see if we have collected all of the titles
if (response.hits.total === allTitles.length) {
console.log('every "test" title', allTitles);
break
}
// get the next response if there are more titles to fetch
responseQueue.push(
await client.scroll({
scrollId: response._scroll_id,
scroll: '30s'
})
);
}
Params
scroll
|
|
scrollId
|
|
restTotalHitsAsInt
|
|
body
|
|
client.search([params, [callback]])
Return documents matching a query, aggregations/facets, highlighted snippets, suggestions, and more. Write your queries as either simple query strings in the q
parameter, or by specifying a full request definition using the Elasticsearch Query DSL in the body
parameter.
Tip
|
bodybuilder and elastic-builder can be used to make building query bodies easier. |
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
const response = await client.search({
index: 'myindex',
q: 'title:test'
});
Hash
const response = await client.search({
index: 'myindex',
body: {
query: {
match: {
title: 'test'
}
},
facets: {
tags: {
terms: {
field: 'tags'
}
}
}
}
});
Params
analyzer
|
|
analyzeWildcard
|
|
[ccsMinimizeRoundtrips=true]
|
|
[defaultOperator=OR]
|
|
df
|
|
explain
|
|
storedFields
|
|
docvalueFields
|
|
from
|
|
ignoreUnavailable
|
|
ignoreThrottled
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
lenient
|
|
preference
|
|
q
|
|
routing
|
|
scroll
|
|
searchType
|
|
size
|
|
sort
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
terminateAfter
|
|
stats
|
|
suggestField
|
|
[suggestMode=missing]
|
|
suggestSize
|
|
suggestText
|
|
timeout
|
|
trackScores
|
|
trackTotalHits
|
|
[allowPartialSearchResults=true]
|
|
typedKeys
|
|
version
|
|
seqNoPrimaryTerm
|
|
requestCache
|
|
[batchedReduceSize=512]
|
|
[maxConcurrentShardRequests=5]
|
|
[preFilterShardSize=128]
|
|
restTotalHitsAsInt
|
|
index
|
|
type
|
|
body
|
|
client.searchShards([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
preference
|
|
routing
|
|
local
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
client.searchTemplate([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
ignoreUnavailable
|
|
ignoreThrottled
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
preference
|
|
routing
|
|
scroll
|
|
searchType
|
|
explain
|
|
profile
|
|
typedKeys
|
|
restTotalHitsAsInt
|
|
[ccsMinimizeRoundtrips=true]
|
|
index
|
|
type
|
|
body
|
|
client.termvectors([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
termStatistics
|
|
[fieldStatistics=true]
|
|
fields
|
|
[offsets=true]
|
|
[positions=true]
|
|
[payloads=true]
|
|
preference
|
|
routing
|
|
realtime
|
|
version
|
|
versionType
|
|
index
|
|
type
|
|
id
|
|
body
|
|
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.
const response = await client.update({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
// put the partial document under the `doc` key
doc: {
title: 'Updated'
}
}
})
tags
property using a script
const response = await client.update({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
script: 'ctx._source.tags += tag',
params: { tag: 'some new tag' }
}
});
const response = await client.update({
index: 'myindex',
type: 'mytype',
id: '777',
body: {
script: 'ctx._source.counter += 1',
upsert: {
counter: 1
}
}
})
const response = await client.update({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
script: 'ctx._source.tags.contains(tag) ? ctx.op = "delete" : ctx.op = "none"',
params: {
tag: 'to-delete'
}
}
});
Params
waitForActiveShards
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
lang
|
|
refresh
|
|
retryOnConflict
|
|
routing
|
|
timeout
|
|
ifSeqNo
|
|
ifPrimaryTerm
|
|
id
|
|
index
|
|
type
|
|
body
|
|
client.updateByQuery([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
analyzer
|
|
analyzeWildcard
|
|
[defaultOperator=OR]
|
|
df
|
|
from
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[conflicts=abort]
|
|
[expandWildcards=open]
|
|
lenient
|
|
pipeline
|
|
preference
|
|
q
|
|
routing
|
|
scroll
|
|
searchType
|
|
searchTimeout
|
|
size
|
|
maxDocs
|
|
sort
|
|
_source
|
|
_sourceExcludes
|
|
_sourceIncludes
|
|
terminateAfter
|
|
stats
|
|
version
|
|
versionType
|
|
requestCache
|
|
refresh
|
|
[timeout=1m]
|
|
waitForActiveShards
|
|
scrollSize
|
|
[waitForCompletion=true]
|
|
requestsPerSecond
|
|
[slices=1]
|
|
index
|
|
type
|
|
body
|
|
client.updateByQueryRethrottle([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
requestsPerSecond
|
|
taskId
|
|
body
|
|
client.cat.aliases([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
name
|
|
client.cat.allocation([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
nodeId
|
|
client.cat.count([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
index
|
|
client.cat.fielddata([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
fields
|
|
client.cat.health([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
[ts=true]
|
|
v
|
|
client.cat.help([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
client.cat.indices([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
local
|
|
masterTimeout
|
|
h
|
|
health
|
|
help
|
|
pri
|
|
s
|
|
v
|
|
includeUnloadedSegments
|
|
index
|
|
client.cat.master([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.nodeattrs([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.nodes([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
fullId
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.pendingTasks([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.plugins([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.recovery([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
index
|
|
client.cat.repositories([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.segments([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
h
|
|
help
|
|
s
|
|
v
|
|
index
|
|
client.cat.shards([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
bytes
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
index
|
|
client.cat.snapshots([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
ignoreUnavailable
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
repository
|
|
client.cat.tasks([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
nodeId
|
|
actions
|
|
detailed
|
|
parentTask
|
|
h
|
|
help
|
|
s
|
|
v
|
|
client.cat.templates([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
name
|
|
client.cat.threadPool([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
format
|
|
size
|
|
local
|
|
masterTimeout
|
|
h
|
|
help
|
|
s
|
|
v
|
|
threadPoolPatterns
|
|
client.cluster.allocationExplain([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeYesDecisions
|
|
includeDiskInfo
|
|
body
|
|
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
|
|
masterTimeout
|
|
timeout
|
|
includeDefaults
|
|
client.cluster.health([params, [callback]])
Get a very simple status on the health of the cluster.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
[expandWildcards=all]
|
|
[level=cluster]
|
|
local
|
|
masterTimeout
|
|
timeout
|
|
waitForActiveShards
|
|
waitForNodes
|
|
waitForEvents
|
|
waitForNoRelocatingShards
|
|
waitForNoInitializingShards
|
|
waitForStatus
|
|
index
|
|
client.cluster.pendingTasks([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
local
|
|
masterTimeout
|
|
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
|
|
masterTimeout
|
|
timeout
|
|
body
|
|
client.cluster.remoteInfo([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
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
|
|
explain
|
|
retryFailed
|
|
metric
|
|
masterTimeout
|
|
timeout
|
|
body
|
|
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
|
|
masterTimeout
|
|
flatSettings
|
|
waitForMetadataVersion
|
|
waitForTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
metric
|
|
client.cluster.stats([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
flatSettings
|
|
timeout
|
|
nodeId
|
|
client.indices.analyze([params, [callback]])
Perform the analysis process on a text and return the tokens breakdown of the text.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
index
|
|
body
|
|
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
|
|
fields
|
|
query
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
request
|
|
body
|
|
client.indices.clone([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
masterTimeout
|
|
waitForActiveShards
|
|
index
|
|
target
|
|
body
|
|
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
|
|
masterTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
waitForActiveShards
|
|
index
|
|
body
|
|
client.indices.create([params, [callback]])
Create an index in Elasticsearch.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
waitForActiveShards
|
|
timeout
|
|
masterTimeout
|
|
index
|
|
body
|
|
client.indices.delete([params, [callback]])
Delete an index in Elasticsearch
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
masterTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
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
|
|
masterTimeout
|
|
index
|
|
name
|
|
body
|
|
client.indices.deleteTemplate([params, [callback]])
Delete an index template by its name.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
masterTimeout
|
|
name
|
|
body
|
|
client.indices.exists([params, [callback]])
Return a boolean indicating whether given index exists.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
local
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
flatSettings
|
|
includeDefaults
|
|
index
|
|
body
|
|
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
|
|
allowNoIndices
|
|
[expandWildcards=all]
|
|
local
|
|
index
|
|
name
|
|
body
|
|
client.indices.existsTemplate([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
flatSettings
|
|
masterTimeout
|
|
local
|
|
name
|
|
body
|
|
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
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
local
|
|
index
|
|
type
|
|
body
|
|
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
|
|
waitIfOngoing
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
client.indices.flushSynced([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
client.indices.forcemerge([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
flush
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
maxNumSegments
|
|
onlyExpungeDeletes
|
|
index
|
|
body
|
|
client.indices.get([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
local
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
flatSettings
|
|
includeDefaults
|
|
masterTimeout
|
|
index
|
|
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
|
|
allowNoIndices
|
|
[expandWildcards=all]
|
|
local
|
|
index
|
|
name
|
|
client.indices.getFieldMapping([params, [callback]])
Retrieve mapping definition of a specific field.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
includeDefaults
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
local
|
|
index
|
|
type
|
|
fields
|
|
client.indices.getMapping([params, [callback]])
Retrieve mapping definition of index or index/type.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
masterTimeout
|
|
local
|
|
index
|
|
type
|
|
client.indices.getSettings([params, [callback]])
Retrieve settings for one or more (or all) indices.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open,closed]
|
|
flatSettings
|
|
local
|
|
includeDefaults
|
|
index
|
|
name
|
|
client.indices.getTemplate([params, [callback]])
Retrieve an index template by its name.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
flatSettings
|
|
masterTimeout
|
|
local
|
|
name
|
|
client.indices.getUpgrade([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
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
|
|
masterTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=closed]
|
|
waitForActiveShards
|
|
index
|
|
body
|
|
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
|
|
masterTimeout
|
|
index
|
|
name
|
|
body
|
|
client.indices.putMapping([params, [callback]])
Register specific mapping definition for a specific type.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
timeout
|
|
masterTimeout
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
type
|
|
body
|
|
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
|
|
timeout
|
|
preserveExisting
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
flatSettings
|
|
index
|
|
body
|
|
client.indices.putTemplate([params, [callback]])
Create an index template that will automatically be applied to new indices created.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
order
|
|
create
|
|
timeout
|
|
masterTimeout
|
|
flatSettings
|
|
name
|
|
body
|
|
client.indices.recovery([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
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
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
body
|
|
client.indices.rollover([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
includeTypeName
|
|
timeout
|
|
dryRun
|
|
masterTimeout
|
|
waitForActiveShards
|
|
alias
|
|
newIndex
|
|
body
|
|
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
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
verbose
|
|
index
|
|
client.indices.shardStores([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
status
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
index
|
|
client.indices.shrink([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
copySettings
|
|
timeout
|
|
masterTimeout
|
|
waitForActiveShards
|
|
index
|
|
target
|
|
body
|
|
client.indices.split([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
copySettings
|
|
timeout
|
|
masterTimeout
|
|
waitForActiveShards
|
|
index
|
|
target
|
|
body
|
|
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
|
|
fielddataFields
|
|
fields
|
|
groups
|
|
[level=indices]
|
|
types
|
|
includeSegmentFileSizes
|
|
includeUnloadedSegments
|
|
[expandWildcards=open]
|
|
[forbidClosedIndices=true]
|
|
index
|
|
metric
|
|
client.indices.updateAliases([params, [callback]])
Update specified aliases.
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
const response = await client.indices.updateAliases({
body: {
actions: [
{ remove: { index: 'logstash-2014.04', alias: 'logstash-current' } },
{ add: { index: 'logstash-2014.05', alias: 'logstash-current' } }
]
}
});
Params
timeout
|
|
masterTimeout
|
|
body
|
|
client.indices.upgrade([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
allowNoIndices
|
|
[expandWildcards=open]
|
|
ignoreUnavailable
|
|
waitForCompletion
|
|
onlyAncientSegments
|
|
index
|
|
body
|
|
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
|
|
ignoreUnavailable
|
|
allowNoIndices
|
|
[expandWildcards=open]
|
|
q
|
|
analyzer
|
|
analyzeWildcard
|
|
[defaultOperator=OR]
|
|
df
|
|
lenient
|
|
rewrite
|
|
allShards
|
|
index
|
|
type
|
|
body
|
|
client.ingest.deletePipeline([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
timeout
|
|
id
|
|
body
|
|
client.ingest.getPipeline([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
id
|
|
client.ingest.processorGrok([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
client.ingest.putPipeline([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
timeout
|
|
id
|
|
body
|
|
client.ingest.simulate([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
verbose
|
|
id
|
|
body
|
|
client.nodes.hotThreads([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
interval
|
|
snapshots
|
|
threads
|
|
ignoreIdleThreads
|
|
type
|
|
timeout
|
|
nodeId
|
|
client.nodes.info([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
flatSettings
|
|
timeout
|
|
nodeId
|
|
metric
|
|
client.nodes.reloadSecureSettings([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
nodeId
|
|
body
|
|
client.nodes.stats([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
completionFields
|
|
fielddataFields
|
|
fields
|
|
groups
|
|
[level=node]
|
|
types
|
|
timeout
|
|
includeSegmentFileSizes
|
|
metric
|
|
indexMetric
|
|
nodeId
|
|
client.nodes.usage([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
timeout
|
|
metric
|
|
nodeId
|
|
client.snapshot.create([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
waitForCompletion
|
|
repository
|
|
snapshot
|
|
body
|
|
client.snapshot.createRepository([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
timeout
|
|
verify
|
|
repository
|
|
body
|
|
client.snapshot.delete([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
repository
|
|
snapshot
|
|
body
|
|
client.snapshot.deleteRepository([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
timeout
|
|
repository
|
|
body
|
|
client.snapshot.get([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
ignoreUnavailable
|
|
verbose
|
|
repository
|
|
snapshot
|
|
client.snapshot.getRepository([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
local
|
|
repository
|
|
client.snapshot.restore([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
waitForCompletion
|
|
repository
|
|
snapshot
|
|
body
|
|
client.snapshot.status([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
ignoreUnavailable
|
|
repository
|
|
snapshot
|
|
client.snapshot.verifyRepository([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
masterTimeout
|
|
timeout
|
|
repository
|
|
body
|
|
client.tasks.cancel([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
nodes
|
|
actions
|
|
parentTaskId
|
|
taskId
|
|
body
|
|
client.tasks.get([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
waitForCompletion
|
|
timeout
|
|
taskId
|
|
client.tasks.list([params, [callback]])
Check the [api-conventions] and the elasticsearch docs for more information pertaining to this method.
Params
nodes
|
|
actions
|
|
detailed
|
|
parentTaskId
|
|
waitForCompletion
|
|
[groupBy=nodes]
|
|
timeout
|
|