Check the elasticsearch guide for details on these commands.
Since: 2.0
Author: Carsten Brandt (mail@cebe.cc)
Inheritance: extends yii\base\Component
Exemplo n.º 1
0
 /**
  * Overridden to return exact type mapping if possible
  *
  * @param string $index
  * @param string $type
  * @param string $data Type of data to be retrieved
  * @return array
  * @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
  */
 public function getMapping($index = '_all', $type = '_all', $data = 'properties')
 {
     $mapping = parent::getMapping($index, $type);
     if ($index !== '_all' && $type !== '_all') {
         $mapping = $mapping[$index]['mappings'][$type][$data];
     }
     return $mapping;
 }
Exemplo n.º 2
0
 /**
  * sets up the index for this record
  * @param Command $command
  * @param boolean $statusIsBoolean
  */
 public static function setUpMapping($command, $statusIsBoolean = false)
 {
     $command->deleteMapping(static::index(), static::type());
     $command->setMapping(static::index(), static::type(), [static::type() => ["_id" => ["path" => "id", "index" => "not_analyzed", "store" => "yes"], "properties" => ["name" => ["type" => "string", "index" => "not_analyzed"], "email" => ["type" => "string", "index" => "not_analyzed"], "address" => ["type" => "string", "index" => "analyzed"], "status" => $statusIsBoolean ? ["type" => "boolean"] : ["type" => "integer"]]]]);
 }
Exemplo n.º 3
0
 /**
  * sets up the index for this record
  * @param Command $command
  */
 public static function setUpMapping($command)
 {
     $command->deleteMapping(static::index(), static::type());
     $command->setMapping(static::index(), static::type(), [static::type() => ["_id" => ["path" => "id", "index" => "not_analyzed", "store" => "yes"], "properties" => ["customer_id" => ["type" => "integer"], "total" => ["type" => "integer"]]]]);
 }
Exemplo n.º 4
0
 /**
  * sets up the index for this record
  * @param Command $command
  */
 public static function setUpMapping($command)
 {
     $command->deleteMapping(static::index(), static::type());
     $command->setMapping(static::index(), static::type(), [static::type() => ["properties" => ["order_id" => ["type" => "integer"], "item_id" => ["type" => "integer"], "quantity" => ["type" => "integer"], "subtotal" => ["type" => "integer"]]]]);
 }