SDK
SDK C++ v1.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.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

setAutoRefresh #

The setAutoRefresh action allows to set the autorefresh flag for the index.

Each index has an autorefresh flag. When set to true, each write request trigger a refresh action on Elasticsearch. Without a refresh after a write request, the documents may not be immediately visible in search.

A refresh operation comes with some performance costs.
While forcing the autoRefresh can be convenient on a development or test environment, we recommend that you avoid using it in production or at least carefully monitor its implications before using it.

Signature #

void setAutoRefresh(const std::string& index, bool auto_refresh);

void setAutoRefresh(
    const std::string& index,
    bool auto_refresh,
    const kuzzleio::query_options& options);

Arguments #

ArgumentsTypeDescription
index
const std::string&
Index name
autoRefresh
bool
Autorefresh flag value
options
kuzzleio::query_options*
Query options

options #

Additional query options

OptionType
(default)
Description
queuable
bool

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

Exceptions #

Throws a kuzzleio::KuzzleException if there is an error. See how to handle error.

Usage #

try {
  kuzzle->index->setAutoRefresh("nyc-open-data", true);
  std::cout << "Autorefresh is now enabled on index" << std::endl;
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}