PHP Class Elastica\Index\Settings

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
Show file Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_data Stats info.
$_index Index.
$_response Response.

Public Methods

Method Description
__construct ( Index $index ) Construct.
get ( string $setting = '' ) : array | string | null Returns the current settings of the index.
getBlocksMetadata ( ) : boolean
getBlocksRead ( ) : boolean
getBlocksWrite ( ) : boolean
getIndex ( ) : Index Returns the index object.
getMergePolicy ( string $key ) : string Returns the specific merge policy value.
getReadOnly ( ) : boolean getReadOnly.
getRefreshInterval ( ) : string Returns the refresh interval.
request ( array $data = [], string $method = Request::GET ) : Response Updates the given settings for the index.
set ( array $data ) : Response Can be used to set/update settings.
setBlocksMetadata ( boolean $state = true ) : Response
setBlocksRead ( boolean $state = true ) : Response
setBlocksWrite ( boolean $state = true ) : Response
setMergePolicy ( string $key, string $value ) : Response Sets the specific merge policies.
setNumberOfReplicas ( integer $replicas ) : Response Sets the number of replicas.
setReadOnly ( boolean $readOnly = true ) : Response Sets the index to read only.
setRefreshInterval ( integer $interval ) : Response Sets the index refresh interval.

Method Details

__construct() public method

Construct.
public __construct ( Index $index )
$index Elastica\Index Index object

get() public method

If param is set, only specified setting is return. 'index.' is added in front of $setting.
public get ( string $setting = '' ) : array | string | null
$setting string OPTIONAL Setting name to return
return array | string | null Settings data

getBlocksMetadata() public method

public getBlocksMetadata ( ) : boolean
return boolean

getBlocksRead() public method

public getBlocksRead ( ) : boolean
return boolean

getBlocksWrite() public method

public getBlocksWrite ( ) : boolean
return boolean

getIndex() public method

Returns the index object.
public getIndex ( ) : Index
return Elastica\Index Index object

getMergePolicy() public method

Returns the specific merge policy value.
public getMergePolicy ( string $key ) : string
$key string Merge policy key (for ex. expunge_deletes_allowed)
return string Refresh interval

getReadOnly() public method

getReadOnly.
public getReadOnly ( ) : boolean
return boolean

getRefreshInterval() public method

If no interval is set, the default interval is returned
public getRefreshInterval ( ) : string
return string Refresh interval

request() public method

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
public request ( array $data = [], string $method = Request::GET ) : Response
$data array OPTIONAL Data array
$method string OPTIONAL Transfer method (default = \Elastica\Request::GET)
return Elastica\Response Response object

set() public method

Can be used to set/update settings.
public set ( array $data ) : Response
$data array Arguments
return Elastica\Response Response object

setBlocksMetadata() public method

public setBlocksMetadata ( boolean $state = true ) : Response
$state boolean OPTIONAL (default = true)
return Elastica\Response

setBlocksRead() public method

public setBlocksRead ( boolean $state = true ) : Response
$state boolean OPTIONAL (default = true)
return Elastica\Response

setBlocksWrite() public method

public setBlocksWrite ( boolean $state = true ) : Response
$state boolean OPTIONAL (default = true)
return Elastica\Response

setMergePolicy() public method

To have this changes made the index has to be closed and reopened
public setMergePolicy ( string $key, string $value ) : Response
$key string Merge policy key (for ex. expunge_deletes_allowed)
$value string
return Elastica\Response

setNumberOfReplicas() public method

Sets the number of replicas.
public setNumberOfReplicas ( integer $replicas ) : Response
$replicas integer Number of replicas
return Elastica\Response Response object

setReadOnly() public method

Sets the index to read only.
public setReadOnly ( boolean $readOnly = true ) : Response
$readOnly boolean (default = true)
return Elastica\Response

setRefreshInterval() public method

Value can be for example 3s for 3 seconds or 5m for 5 minutes. -1 refreshing is disabled.
public setRefreshInterval ( integer $interval ) : Response
$interval integer Number of milliseconds
return Elastica\Response Response object

Property Details

$_data protected property

Stats info.
protected $_data

$_index protected property

Index.
protected $_index

$_response protected property

Response.
protected $_response