SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

refreshIndex #

When writing or deleting documents in Kuzzle, the update needs to be indexed before being reflected in the search index. By default, this operation can take up to 1 second.

Given an index, the refresh action forces a refresh, on it, making the documents visible to search immediately.

A refresh operation comes with some performance costs.

From elasticsearch documentation:
"While a refresh is much lighter than a commit, it still has a performance cost. A manual refresh can be useful when writing tests, but don’t do a manual refresh every time you index a document in production; it will hurt your performance. Instead, your application needs to be aware of the near real-time nature of Elasticsearch and make allowances for it."

refreshIndex([index], [options], [callback]) #

ArgumentTypeDescription
indexstringOptional. The index to refresh. If not set, defaults to kuzzle.defaultIndex.
optionsJSON objectOptional parameters
callbackfunctionOptional. Callback handling the response.

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the Kuzzle SDK object to allow chaining.


Callback Response #

Returns a JSON structure matching the response from Elasticsearch.

Usage #

kuzzle.refreshIndex('myIndex');