【问题标题】:Couchebase create global secondary index in CouchebaseCouchbase 在 Couchbase 中创建全局二级索引
【发布时间】:2017-10-11 09:22:58
【问题描述】:
bucket.bucketManager().createN1qlIndex(indexName, fields, where, true, false);

我需要知道where参数,以防万一

create index index_ABC on bucketname(fieldname) where xyzField=XYZ

给定:XYZ 是一个变量。

【问题讨论】:

  • 你能提供更多细节吗?我不确定问题是什么。

标签: java database indexing where-clause n1ql


【解决方案1】:

它必须是常数值。

创建索引def_name_type ON travel-sample(name) WHERE (type = "User");

这称为部分索引。在type = "User" 的所有文档的名称字段上索引 def_name_type 索引。 CREATE Index 中的 WHERE 子句是可选的。如果它存在,则查询中需要存在完全相同的东西,否则将不会选择索引。

示例: SELECT META().id FROM travel-sample WHERE name = "xyz" AND type = "User";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-09
    • 1970-01-01
    • 1970-01-01
    • 2020-11-12
    • 1970-01-01
    相关资源
    最近更新 更多