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

getMergePolicyType()

getMergePolicyType() : string

Return merge policy.

Returns

string —

Merge policy type

setMergePolicyType()

setMergePolicyType(string  $type) : \Elastica\Response

Sets merge policy.

Parameters

string $type

Merge policy type

Returns

\Elastica\Response

Response object

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