getAutoRefresh

The getAutoRefresh action returns the current autorefresh status 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

Copied to clipboard!
bool getAutoRefresh(const std::string& index);

bool getAutoRefresh(const std::string& index, const kuzzleio::query_options& options);

Arguments

Arguments Type Description
index
const std::string&
Index name
options
kuzzleio::query_options*
Query options

options

Additional query options

Option Type
(default)
Description
queuable
bool

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

Return

A boolean indicating the status of the autoRefresh flag.

Exceptions

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

Usage

Copied to clipboard!
try {
  bool autorefresh_flag = kuzzle->index->getAutoRefresh("nyc-open-data");

  if (autorefresh_flag) {
    std::cout << "Autorefresh is enabled" << std::endl;
  } else {
    std::cerr << "Autorefresh is disabled" << std::endl;
  }
} catch (kuzzleio::KuzzleException &e) {
  std::cerr << e.what() << std::endl;
}