\Elastica\TypeMapping

Elastica Mapping object.

Summary

Methods
Properties
Constants
__construct()
setType()
setProperties()
getProperties()
setMeta()
getType()
setSource()
disableSource()
setParam()
getParam()
setAllField()
enableAllField()
setTtl()
enableTtl()
setParent()
toArray()
send()
create()
No public properties found
No constants found
No protected methods found
$_mapping
$_type
N/A
No private methods found
No private properties found
N/A

Properties

$_mapping

$_mapping : array

Mapping.

Type

array — Mapping

$_type

$_type : \Elastica\Type

Type.

Type

\Elastica\Type — Type object

Methods

__construct()

__construct(\Elastica\Type  $type = null, array  $properties = array()) 

Construct Mapping.

Parameters

\Elastica\Type $type

OPTIONAL Type object

array $properties

OPTIONAL Properties

setType()

setType(\Elastica\Type  $type) : $this

Sets the mapping type Enter description here .

..

Parameters

\Elastica\Type $type

Type object

Returns

$this

setProperties()

setProperties(array  $properties) : $this

Sets the mapping properties.

Parameters

array $properties

Properties

Returns

$this

getProperties()

getProperties() : array

Gets the mapping properties.

Returns

array —

$properties Properties

setMeta()

setMeta(array  $meta) : $this

Sets the mapping _meta.

Parameters

array $meta

metadata

Returns

$this

getType()

getType() : \Elastica\Type

Returns mapping type.

Returns

\Elastica\Type

Type

setSource()

setSource(array  $source) : $this

Sets source values.

To disable source, argument is array('enabled' => false)

Parameters

array $source

Source array

Returns

$this

disableSource()

disableSource(boolean  $enabled = false) : $this

Disables the source in the index.

Param can be set to true to enable again

Parameters

boolean $enabled

OPTIONAL (default = false)

Returns

$this

setParam()

setParam(string  $key, mixed  $value) : $this

Sets raw parameters.

Possible options: _uid _id _type _source _all _analyzer _boost _parent _routing _index _size properties

Parameters

string $key

Key name

mixed $value

Key value

Returns

$this

getParam()

getParam(string  $key) : mixed

Get raw parameters.

Parameters

string $key

Key name

Returns

mixed —

$value Key value

setAllField()

setAllField(array  $params) : $this

Sets params for the "_all" field.

Parameters

array $params

_all Params (enabled, store, term_vector, analyzer)

Returns

$this

enableAllField()

enableAllField(boolean  $enabled = true) : $this

Enables the "_all" field.

Parameters

boolean $enabled

OPTIONAL (default = true)

Returns

$this

setTtl()

setTtl(array  $params) : $this

Set TTL.

Parameters

array $params

TTL Params (enabled, default, ...)

Returns

$this

enableTtl()

enableTtl(boolean  $enabled = true) : $this

Enables TTL for all documents in this type.

Parameters

boolean $enabled

OPTIONAL (default = true)

Returns

$this

setParent()

setParent(string  $type) : $this

Set parent type.

Parameters

string $type

Parent type

Returns

$this

toArray()

toArray() : array

Converts the mapping to an array.

Throws

\Elastica\Exception\InvalidException

Returns

array —

Mapping as array

send()

send(array  $query = array()) : \Elastica\Response

Submits the mapping and sends it to the server.

Parameters

array $query

Query string parameters to send with mapping

Returns

\Elastica\Response

Response object

create()

create(array|\Elastica\Type\Mapping  $mapping) : self

Creates a mapping object.

Parameters

array|\Elastica\Type\Mapping $mapping

Mapping object or properties array

Throws

\Elastica\Exception\InvalidException

If invalid type

Returns

self