Yii2 framework backup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
1.0 KiB

<?php
namespace yiiunit\data\ar\elasticsearch;
use yii\elasticsearch\Command;
/**
* Class Item
*
* @property integer $id
* @property string $name
* @property integer $category_id
*/
class Item extends ActiveRecord
{
public static function primaryKey()
{
return ['id'];
}
public function attributes()
{
return ['id', 'name', 'category_id'];
}
/**
* 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" => [
"name" => ["type" => "string", "index" => "not_analyzed"],
"category_id" => ["type" => "integer"],
]
]
]);
}
}