\ElasticaMapping

Elastica Mapping object.

Summary

Methods
Properties
Constants
__construct()
setProperties()
getProperties()
setMeta()
setSource()
disableSource()
setParam()
getParam()
toArray()
send()
create()
No public properties found
No constants found
No protected methods found
$_mapping
N/A
No private methods found
No private properties found
N/A

Properties

$_mapping

$_mapping : array

Mapping.

Type

array — Mapping

Methods

__construct()

__construct(array  $properties = array()) 

Construct Mapping.

Parameters

array $properties

OPTIONAL Properties

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

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 _analyzer _boost _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

toArray()

toArray() : array

Converts the mapping to an array.

Throws

\Elastica\Exception\InvalidException

Returns

array —

Mapping as array

send()

send(\Elastica\Index  $index, array  $query = array()) : \Elastica\Response

Submits the mapping and sends it to the server.

Parameters

\Elastica\Index $index

the index to send the mappings to

array $query

Query string parameters to send with mapping

Returns

\Elastica\Response

Response object

create()

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

Creates a mapping object.

Parameters

array|\Elastica\Mapping $mapping

Mapping object or properties array

Throws

\Elastica\Exception\InvalidException

If invalid type

Returns

self