数据库 - Model 前置说明
官方开源项目 抓取代理IP

参数说明

用途:创建一个索引表
依赖类:\x\Elasticsearch
方法名:createTable()

参数:

  • array $settings

    • 功能:配置信息,对应ES的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);

SW-X

企业级 - 高性能 PHP 框架

最后更新:2年前 . 作者-小黄牛

本篇目录