Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在关系类型(neo4j)上创建索引_Sql_Neo4j - Fatal编程技术网

Sql 如何在关系类型(neo4j)上创建索引

Sql 如何在关系类型(neo4j)上创建索引,sql,neo4j,Sql,Neo4j,我对neo4j很陌生。我正在Windows下运行shell。 我已经创建了一个名为:user的节点,我在id上有索引。user有id和name属性 我建立了一种叫做朋友的关系。(用户1,用户2) neo4j.properties设置为: # Enable auto-indexing for nodes, default is false node_auto_indexing=true # The node property keys to be auto-indexed, if enabled

我对neo4j很陌生。我正在Windows下运行shell。 我已经创建了一个名为:user的节点,我在id上有索引。user有id和name属性

我建立了一种叫做朋友的关系。(用户1,用户2)

neo4j.properties设置为:

# Enable auto-indexing for nodes, default is false
node_auto_indexing=true

# The node property keys to be auto-indexed, if enabled
node_keys_indexable=id

# Enable auto-indexing for relationships, default is false
relationship_auto_indexing=true

# The relationship property keys to be auto-indexed, if enabled
relationship_keys_indexable=user1,user2
我的问题是:

1-当我键入::schema ls时,它显示:

Indexes
  ON :User(id) ONLINE  

No constraints
为什么它不显示关系上的索引


2-如何使用shell手动创建关系索引?

当您键入
:schema
时,您看到的索引是Neo4j中的新型索引。似乎
节点自动索引
关系自动索引
(以及
*\u键可索引
)配置属性是Neo4j传统索引的一部分:

我不太熟悉遗留索引,但在新型索引中,没有关系索引。在该范例中,您首先通过节点的索引找到节点,然后从中跟踪关系,但是如果不首先找到节点,就无法直接查询关系

您可以在此处阅读有关旧索引的内容:

但我将复制/粘贴一段有用的文章:

“从Neo4j 2.0开始,这不是Neo4j中最受欢迎的数据索引方法,我们建议在数据库架构中定义索引。”

但是,对旧索引的支持仍然存在,因为某些功能(如唯一性约束)尚未由新索引处理

不过,我不认为这是完全正确的,因为Neo4j在DB模式中支持唯一约束已有一段时间了: