建立了索引查不出数据

建立了索引查不出数据,大家帮忙看一下

(root@nebula) [basketballplayer]> create tag index i_player on player();
Execution succeeded (time spent 4628/5073 us)

Mon, 10 May 2021 17:42:16 CST


(root@nebula) [basketballplayer]> create tag index i_team on team()
Execution succeeded (time spent 4756/5312 us)

Mon, 10 May 2021 17:42:50 CST

(root@nebula) [basketballplayer]> match(n) return n;
[ERROR (-12)]: SemanticError: Can't solve the start vids from the sentence: MATCH (n) RETURN n

Mon, 10 May 2021 17:43:02 CST

(root@nebula) [basketballplayer]> match(n:player) return n;
Empty set (time spent 2810/3390 us)

Mon, 10 May 2021 17:44:01 CST

(root@nebula) [basketballplayer]> lookup on player;
Empty set (time spent 2132/2725 us)

Mon, 10 May 2021 17:44:08 CST

(root@nebula) [basketballplayer]> GO FROM "player100" OVER follow;
+-------------+
| follow._dst |
+-------------+
| "player101" |
+-------------+
| "player125" |
+-------------+
Got 2 rows (time spent 1741/2341 us)

Mon, 10 May 2021 17:44:20 CST

(root@nebula) [basketballplayer]> match(n:player) return n;
Empty set (time spent 4373/4971 us)

Mon, 10 May 2021 17:44:33 CST

(root@nebula) [basketballplayer]> lookup on player;
Empty set (time spent 2460/3050 us)

Mon, 10 May 2021 17:44:57 CST

(root@nebula) [basketballplayer]> show stats
+---------+------------+-------+
| Type    | Name       | Count |
+---------+------------+-------+
| "Tag"   | "player"   | 51    |
+---------+------------+-------+
| "Tag"   | "team"     | 30    |
+---------+------------+-------+
| "Edge"  | "follow"   | 81    |
+---------+------------+-------+
| "Edge"  | "serve"    | 146   |
+---------+------------+-------+
| "Space" | "vertices" | 81    |
+---------+------------+-------+
| "Space" | "edges"    | 227   |
+---------+------------+-------+
Got 6 rows (time spent 975/1537 us)

Mon, 10 May 2021 17:45:08 CST

(root@nebula) [basketballplayer]> fetch prop on  player "player125"
+-------------------------------------------------------+
| vertices_                                             |
+-------------------------------------------------------+
| ("player125" :player{age: 41, name: "Manu Ginobili"}) |
+-------------------------------------------------------+
Got 1 rows (time spent 1833/2438 us)

Mon, 10 May 2021 17:48:37 CST

(root@nebula) [basketballplayer]> fetch prop on  player
[ERROR (-7)]: SyntaxError: syntax error near ` '

Mon, 10 May 2021 17:48:54 CST

(root@nebula) [basketballplayer]> lookup on player;
Empty set (time spent 1509/2100 us)

Mon, 10 May 2021 17:49:02 CST

(root@nebula) [basketballplayer]>

请问您有rebuild 索引么?

真的没有rebuild索引。去看了一下资料明白了。

为保障服务性能,索引不会自动对其创建之前已存在的数据生效。请在创建索引后,选择合适的时间为存量数据重建索引。在索引重建完成之前,无法基于该索引使用LOOKUP和MATCH语句查询到存量数据。使用索引的详情请参见CREATE INDEX

1赞

又有一个新问题,我在rebuild 索引前就有name这个索引了,这是不是我建立的,这个是什么索引呢?

(root@nebula) [basketballplayer]> SHOW TAG INDEX STATUS;
+------------+--------------+
| Name       | Index Status |
+------------+--------------+
| "name"     | "FINISHED"   |
+------------+--------------+
| "i_team"   | "FINISHED"   |
+------------+--------------+
| "i_player" | "FINISHED"   |
+------------+--------------+
Got 3 rows (time spent 1929/2573 us)

(root@nebula) [basketballplayer]> show create tag index name;
[ERROR (-8)]: Not existed!

Mon, 10 May 2021 18:22:22 CST

(root@nebula) [basketballplayer]> show create tag index "name";
[ERROR (-7)]: SyntaxError: syntax error near `";'

Mon, 10 May 2021 18:22:38 CST

(root@nebula) [basketballplayer]> show create tag index i_team;
+----------------+----------------------------------------+
| Tag Index Name | Create Tag Index                       |
+----------------+----------------------------------------+
| "i_team"       | "CREATE TAG INDEX `i_team` ON `team` ( |
|                | )"                                     |
+----------------+----------------------------------------+

@wey 老师再看一下

没有太明白,是说存在一个叫做 name 的 TAG INDEX ? 怎么得出这个结论的?

hmmm… 我在本地试了可以创建name 名字的索引哈,name 并不是保留关键字。是不是你之前不小心创建了那个index?

(user@nebula) [basketballplayer]> create tag index name on team()
Execution succeeded (time spent 8033/8539 us)

Mon, 10 May 2021 11:22:07 UTC

(user@nebula) [basketballplayer]> show tag indexes;
+------------------+
| Names            |
+------------------+
| "name"           |
+------------------+
| "playerindex"    |
+------------------+
Got 2 rows (time spent 1612/2173 us)

(user@nebula) [basketballplayer]> SHOW CREATE TAG INDEX name
+----------------+--------------------------------------+
| Tag Index Name | Create Tag Index                     |
+----------------+--------------------------------------+
| "name"         | "CREATE TAG INDEX `name` ON `team` ( |
|                | )"                                   |
+----------------+--------------------------------------+

hmmmm… show create tag index name; 为什么查不到呢?你看show create tag index i_team; 都可以的,而且在你的代码里SHOW CREATE TAG INDEX name 是有结果的哦

确实有点奇怪,找dev同学帮忙看看哈。

你执行下 show hosts meta,将结果截图下

1赞

创建索引之前的数据需要rebuild一下才能查出来

1赞

执行 show tag indexes 截图

image

可以看出,你曾经创建过 name 这个 index,也进行过 rebuild,但是你后面把它删除了,所以 show create 找不到它,那么你的 i_player 和 i_team 的rebuild 状态也可能是之前的,有可能你的space都重新创建过,所以这个index name不是对应同一个,所以你重新 rebuild 下,应该就可以查出数据。

3赞

好的

浙ICP备20010487号