Javascript 7.x

refresh

Refreshes a collection to reindex the written and deleted documents so they are available in search results.

A refresh operation comes with some performance costs.

From the 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."


Copied to clipboard!
refresh(index, collection, [options]);

Arguments Type Description
options
object
Query options

options

Additional query options

Property Type
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again

Resolves

Resolves when the refresh has been done.

Usage

Copied to clipboard!
try {
  await kuzzle.collection.refresh('nyc-open-data', 'yellow-taxi');
  console.log('Refresh successful');
} catch (error) {
  console.error(error.message);
}