setAutoRefresh(index, autorefresh, [options]) #
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.
Arguments #
SetAutoRefresh(index string, autoRefresh bool, options types.QueryOptions) error
Arguments | Type | Description |
---|---|---|
index | string | Index name |
autoRefresh | Boolean | autoRefresh flag |
options | QueryOptions | Query options |
Options #
Additional query options
Option | Type | Description | Default |
---|---|---|---|
queuable | bool | Make this request queuable or not | true |
Return #
Return an error or nil
.
Usage #
err := kuzzle.Index.SetAutoRefresh("nyc-open-data", true, nil)
if err != nil {
log.Fatal(err)
} else {
fmt.Println("autorefresh flag is set to true")
}