Constants

DEFAULT_REFRESH_INTERVAL

DEFAULT_REFRESH_INTERVAL

DEFAULT_NUMBER_OF_REPLICAS

DEFAULT_NUMBER_OF_REPLICAS

DEFAULT_NUMBER_OF_SHARDS

DEFAULT_NUMBER_OF_SHARDS

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

getBool()

getBool(string  $setting) : boolean

Returns a setting interpreted as a bool.

One can use a real bool, int(0), int(1) to set bool settings. But Elasticsearch stores and returns all settings as strings and does not normalize bool values. This method ensures a bool is returned for whichever string representation is used like 'true', '1', 'on', 'yes'.

Parameters

string $setting

Setting name to return

Returns

boolean

setNumberOfReplicas()

setNumberOfReplicas(integer  $replicas) : \Elastica\Response

Sets the number of replicas.

Parameters

integer $replicas

Number of replicas

Returns

\Elastica\Response

Response object

getNumberOfReplicas()

getNumberOfReplicas() : integer

Returns the number of replicas.

If no number of replicas is set, the default number is returned

Returns

integer —

The number of replicas

getNumberOfShards()

getNumberOfShards() : integer

Returns the number of shards.

If no number of shards is set, the default number is returned

Returns

integer —

The number of shards

setReadOnly()

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

Sets the index to read only.

Parameters

boolean $readOnly

(default = true)

Returns

\Elastica\Response

getReadOnly()

getReadOnly() : boolean

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

Set to true to disable index metadata reads and writes.

Parameters

boolean $state

OPTIONAL (default = true)

Returns

\Elastica\Response

setRefreshInterval()

setRefreshInterval(string  $interval) : \Elastica\Response

Sets the index refresh interval.

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

Parameters

string $interval

Duration of the refresh interval

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