setAutoRefresh

The autoRefresh flag, when set to true, will make Kuzzle perform a refresh request immediately after each write request, causing documents to be immediately visible in a search.

Given an index, the setAutoRefresh function updates its autoRefresh status.

A refresh operation comes with some performance costs.

While forcing the autoRefresh can be convenient on a development or test environmnent, we recommend that you avoid using it in production or at least carefully monitor its implications before using it.


setAutoRefresh([index], autoRefresh, [options], [callback])

Argument Type Description
index string Optional The index to set the autoRefresh for. If not set, defaults to kuzzle.defaultIndex.
autoRefresh boolean The value to set for the autoRefresh setting.
options JSON object Optional parameters
callback function Optional Callback handling the response

Options

Option Type Description Default
queuable boolean Make this request queuable or not true

Return Value

Returns the Kuzzle SDK object to allow chaining.


Callback Response

Returns a boolean with the new autoRefresh status.

Usage

Copied to clipboard!

<?php
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');

$kuzzle->setAutoRefresh('myIndex', true);