\Elastica\IndexSettings

Elastica index settings object.

All settings listed in the update settings API (https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html) can be changed on a running indices. To make changes like the merge policy (https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html) the index has to be closed first and reopened after the call

Summary

Methods
Properties
Constants
__construct()
get()
setNumberOfReplicas()
setReadOnly()
getReadOnly()
getBlocksRead()
setBlocksRead()
getBlocksWrite()
setBlocksWrite()
getBlocksMetadata()
setBlocksMetadata()
setRefreshInterval()
getRefreshInterval()
setMergePolicy()
getMergePolicy()
set()
getIndex()
request()
No public properties found
DEFAULT_REFRESH_INTERVAL
No protected methods found
$_response
$_data
$_index
N/A
No private methods found
No private properties found
N/A

Constants

DEFAULT_REFRESH_INTERVAL

DEFAULT_REFRESH_INTERVAL

Properties

$_response

$_response : \Elastica\Response

Response.

Type

\Elastica\Response — Response object

$_data

$_data : array

Stats info.

Type

array — Stats info

$_index

$_index : \Elastica\Index

Index.

Type

\Elastica\Index — Index object

Methods

__construct()

__construct(\Elastica\Index  $index) 

Construct.

Parameters

\Elastica\Index $index

Index object

get()

get(string  $setting = '') : array|string|null

Returns the current settings of the index.

If param is set, only specified setting is return. 'index.' is added in front of $setting.

Parameters

string $setting

OPTIONAL Setting name to return

Returns

array|string|null —

Settings data

setNumberOfReplicas()

setNumberOfReplicas(integer  $replicas) : \Elastica\Response

Sets the number of replicas.

Parameters

integer $replicas

Number of replicas

Returns

\Elastica\Response

Response object

setReadOnly()

setReadOnly(boolean  $readOnly = true) : \Elastica\Response

Sets the index to read only.

Parameters

boolean $readOnly

(default = true)

Returns

\Elastica\Response

getReadOnly()

getReadOnly() : boolean

getReadOnly.

Returns

boolean

getBlocksRead()

getBlocksRead() : boolean

Returns

boolean

setBlocksRead()

setBlocksRead(boolean  $state = true) : \Elastica\Response

Parameters

boolean $state

OPTIONAL (default = true)

Returns

\Elastica\Response

getBlocksWrite()

getBlocksWrite() : boolean

Returns

boolean

setBlocksWrite()

setBlocksWrite(boolean  $state = true) : \Elastica\Response

Parameters

boolean $state

OPTIONAL (default = true)

Returns

\Elastica\Response

getBlocksMetadata()

getBlocksMetadata() : boolean

Returns

boolean

setBlocksMetadata()

setBlocksMetadata(boolean  $state = true) : \Elastica\Response

Parameters

boolean $state

OPTIONAL (default = true)

Returns

\Elastica\Response

setRefreshInterval()

setRefreshInterval(integer  $interval) : \Elastica\Response

Sets the index refresh interval.

Value can be for example 3s for 3 seconds or 5m for 5 minutes. -1 refreshing is disabled.

Parameters

integer $interval

Number of milliseconds

Returns

\Elastica\Response

Response object

getRefreshInterval()

getRefreshInterval() : string

Returns the refresh interval.

If no interval is set, the default interval is returned

Returns

string —

Refresh interval

setMergePolicy()

setMergePolicy(string  $key, string  $value) : \Elastica\Response

Sets the specific merge policies.

To have this changes made the index has to be closed and reopened

Parameters

string $key

Merge policy key (for ex. expunge_deletes_allowed)

string $value

Returns

\Elastica\Response

getMergePolicy()

getMergePolicy(string  $key) : string

Returns the specific merge policy value.

Parameters

string $key

Merge policy key (for ex. expunge_deletes_allowed)

Returns

string —

Refresh interval

set()

set(array  $data) : \Elastica\Response

Can be used to set/update settings.

Parameters

array $data

Arguments

Returns

\Elastica\Response

Response object

getIndex()

getIndex() : \Elastica\Index

Returns the index object.

Returns

\Elastica\Index

Index object

request()

request(array  $data = array(), string  $method = \Elastica\Request::GET) : \Elastica\Response

Updates the given settings for the index.

With elasticsearch 0.16 the following settings are supported

  • index.term_index_interval
  • index.term_index_divisor
  • index.translog.flush_threshold_ops
  • index.translog.flush_threshold_size
  • index.translog.flush_threshold_period
  • index.refresh_interval
  • index.merge.policy
  • index.auto_expand_replicas

Parameters

array $data

OPTIONAL Data array

string $method

OPTIONAL Transfer method (default = \Elastica\Request::GET)

Returns

\Elastica\Response

Response object