用途:创建一个索引表
依赖类:\x\Elasticsearch
方法名:createTable()
参数:
array $settings
settings
。null
array $field
null
返回值:this
使用示例:
$Elasticsearch = new \x\Elasticsearch();
// 索引表配置
$settings = [
'number_of_shards' => 5, // 分片值5
'number_of_replicas' => 0 // 分布式拷贝数量为0
];
// 字段信息
$field = [
'title' => [
'type' => 'text',
],
'age' => [
'type' => 'integer',
],
];
// 创建索引
$res = $Elasticsearch->table('shop')->createTable($settings, $field);
var_dump($res);