match报错: [ERROR (-8)]: IndexNotFound: No valid index found

  • nebula 版本:“b4f6f0a”
  • 问题描述:建立 tag index,对多个属性进行索引,然后match语句查询时,只有第一个属性有效,对其他属性索引都会报错:IndexNotFound: No valid index found,关于index的描述,以及具体报错内容如图:

创建index的方法如下

CREATE TAG INDEX sugUserVertexMixedIndex ON vertex_user(userid int64, username fixed_string(15), shopid int64, fraud_tag int64, is_cb_seller int64)
REBUILD TAG INDEX sugUserVertexMixedIndex 

请大佬们帮忙看一下,谢谢~

你创建的是复合索引, 所以查询的时候用prefix匹配, 匹配到了第一个属性.
要分别查询属性的话要建立多个索引, 如
CREATE TAG INDEX vnameIndex ON vertex_user(username fixed_string(15))

1 个赞

复合属性索引被LOOKUP 或者 MATCH使用时,遵循"最左匹配原则",必须从复合属性索引的最左侧开始匹配。请参见下方示例:

# 为Tag t的前三个属性创建复合属性索引。
nebula> CREATE TAG INDEX example_index ON t(p1, p2, p3);
# 可以匹配到索引。
nebula> LOOKUP ON t WHERE p1 == 1;
# 可以匹配到索引,因为p1和p2是连续的。
nebula> LOOKUP ON t WHERE p1 == 1 and p2 == 1;
# 可以匹配到索引,因为p1、p2、p3是连续的。
nebula> LOOKUP ON t WHERE p1 == 1 and p2 == 1 and p3 == 1;
# 注意:无法匹配到索引,因为不是从p1开始。 
nebula> LOOKUP ON t WHERE p2 == 1 and p3 == 1;
2 个赞

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。