本文整理汇总了PHP中Elastica\Type\Mapping::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapping::getProperties方法的具体用法?PHP Mapping::getProperties怎么用?PHP Mapping::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Type\Mapping
的用法示例。
在下文中一共展示了Mapping::getProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateElasticsearchMapping
/**
* Add a mapping for the location of the photograph
*/
public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping)
{
// get the properties of the individual fields as an array
$properties = $mapping->getProperties();
// enable tags to be faceted
$properties['RawValue'] = array('type' => 'string', 'index' => 'not_analyzed');
// set the new properties on the mapping
$mapping->setProperties($properties);
return $mapping;
}
示例2: updateElasticsearchMapping
/**
* Add a mapping for the location of the photograph
*/
public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping)
{
// get the properties of the individual fields as an array
$properties = $mapping->getProperties();
// add a location with geo point
$precision1cm = array('format' => 'compressed', 'precision' => '1cm');
$properties['location'] = array('type' => 'geo_point', 'fielddata' => $precision1cm);
$properties['ShutterSpeed'] = array('type' => 'string', 'index' => 'not_analyzed');
$properties['Aperture'] = array('type' => 'double');
// by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s
$properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s');
// set the new properties on the mapping
$mapping->setProperties($properties);
return $mapping;
}
示例3: testGetters
/**
* @group functional
*/
public function testGetters()
{
$index = $this->_createIndex();
$type = $index->getType('test');
$properties = array('firstname' => array('type' => 'string', 'store' => true), 'lastname' => array('type' => 'string'));
$mapping = new Mapping($type, $properties);
$all = array('enabled' => true, 'store' => true);
$mapping->setParam('_all', $all);
$get_all = $mapping->getParam('_all');
$this->assertEquals($get_all, $all);
$this->assertNull($mapping->getParam('_boost', $all));
$this->assertEquals($properties, $mapping->getProperties());
$index->delete();
}