• 渗透表
透析表是一种特殊的表,用于存储查询而非文档。它用于前瞻性搜索或“反向搜索”。
透析表的模式是固定的,包含以下字段:
请注意,在创建透析表时,您不需要添加上述字段。
创建新透析表时,需要记住的是指定文档的预期模式,该模式将在您稍后添加的规则中进行检查。此过程与其他本地表的创建方式相同。
通过 SQL 创建透析表:
CREATE TABLE products(title text, meta json) type='pq';Query OK, 0 rows affected (0.00 sec)通过 HTTP 使用 JSON 创建透析表:
POST /cli -d "CREATE TABLE products(title text, meta json) type='pq'"{
"total":0,
"error":"",
"warning":""
}通过PHP客户端创建透析表:
$index = [
    'index' => 'products',
    'body' => [
        'columns' => [
            'title' => ['type' => 'text'],
            'meta' => ['type' => 'json']
        ],
        'settings' => [
            'type' => 'pq'
        ]
    ]
];
$client->indices()->create($index);Array(
    [total] => 0
    [error] =>
    [warning] =>
)Python:
utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'')Javascript:
res = await utilsApi.sql('CREATE TABLE products(title text, meta json) type=\'pq\'');java:
utilsApi.sql("CREATE TABLE products(title text, meta json) type='pq'");C#:
utilsApi.Sql("CREATE TABLE products(title text, meta json) type='pq'");TypeScript:
res = await utilsApi.sql("CREATE TABLE products(title text, meta json) type='pq'");Go:
apiClient.UtilsAPI.Sql(context.Background()).Body("CREATE TABLE products(title text, meta json) type='pq'").Execute()通过配置文件创建透析表
table products {
  type = percolate
  path = tbl_pq
  rt_field = title
  rt_attr_json = meta
}最后更新于