PHP Class Elastica\Type\Mapping

Mostra file Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_mapping Mapping.
$_type Type.

Public Methods

Method Description
__construct ( Type $type = null, array $properties = [] ) Construct Mapping.
create ( array | Mapping $mapping ) : self Creates a mapping object.
disableSource ( boolean $enabled = false ) Disables the source in the index.
enableAllField ( boolean $enabled = true ) Enables the "_all" field.
enableTtl ( boolean $enabled = true ) Enables TTL for all documents in this type.
getParam ( string $key ) : mixed Get raw parameters.
getProperties ( ) : array Gets the mapping properties.
getType ( ) : Type Returns mapping type.
send ( array $query = [] ) : Response Submits the mapping and sends it to the server.
setAllField ( array $params ) Sets params for the "_all" field.
setMeta ( array $meta ) Sets the mapping _meta.
setParam ( string $key, mixed $value ) Sets raw parameters.
setParent ( string $type ) Set parent type.
setProperties ( array $properties ) Sets the mapping properties.
setSource ( array $source ) Sets source values.
setTtl ( array $params ) Set TTL.
setType ( Type $type ) Sets the mapping type Enter description here .
toArray ( ) : array Converts the mapping to an array.

Method Details

__construct() public method

Construct Mapping.
public __construct ( Type $type = null, array $properties = [] )
$type Elastica\Type OPTIONAL Type object
$properties array OPTIONAL Properties

create() public static method

Creates a mapping object.
public static create ( array | Mapping $mapping ) : self
$mapping array | Mapping Mapping object or properties array
return self

disableSource() public method

Param can be set to true to enable again
public disableSource ( boolean $enabled = false )
$enabled boolean OPTIONAL (default = false)

enableAllField() public method

Enables the "_all" field.
public enableAllField ( boolean $enabled = true )
$enabled boolean OPTIONAL (default = true)

enableTtl() public method

Enables TTL for all documents in this type.
public enableTtl ( boolean $enabled = true )
$enabled boolean OPTIONAL (default = true)

getParam() public method

Get raw parameters.
See also: setParam
public getParam ( string $key ) : mixed
$key string Key name
return mixed $value Key value

getProperties() public method

Gets the mapping properties.
public getProperties ( ) : array
return array $properties Properties

getType() public method

Returns mapping type.
public getType ( ) : Type
return Elastica\Type Type

send() public method

Submits the mapping and sends it to the server.
public send ( array $query = [] ) : Response
$query array Query string parameters to send with mapping
return Elastica\Response Response object

setAllField() public method

Sets params for the "_all" field.
public setAllField ( array $params )
$params array _all Params (enabled, store, term_vector, analyzer)

setMeta() public method

Sets the mapping _meta.
public setMeta ( array $meta )
$meta array metadata

setParam() public method

Possible options: _uid _id _type _source _all _analyzer _boost _parent _routing _index _size properties
public setParam ( string $key, mixed $value )
$key string Key name
$value mixed Key value

setParent() public method

Set parent type.
public setParent ( string $type )
$type string Parent type

setProperties() public method

Sets the mapping properties.
public setProperties ( array $properties )
$properties array Properties

setSource() public method

To disable source, argument is array('enabled' => false)
public setSource ( array $source )
$source array Source array

setTtl() public method

Set TTL.
public setTtl ( array $params )
$params array TTL Params (enabled, default, ...)

setType() public method

..
public setType ( Type $type )
$type Elastica\Type Type object

toArray() public method

Converts the mapping to an array.
public toArray ( ) : array
return array Mapping as array

Property Details

$_mapping protected_oe property

Mapping.
protected $_mapping

$_type protected_oe property

Type.
protected $_type