getProperties() public method

Gets the mapping properties.
public getProperties ( ) : array
return array $properties Properties
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #3
0
 /**
  * @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();
 }