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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.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
在cypher Neo4j中使用scrollid从elastic重新加载数据?_Neo4j_Cypher - Fatal编程技术网

在cypher Neo4j中使用scrollid从elastic重新加载数据?

在cypher Neo4j中使用scrollid从elastic重新加载数据?,neo4j,cypher,Neo4j,Cypher,我使用scrollid从Elasticsearch加载数据 CREATE CONSTRAINT ON (cus:Customer) ASSERT cus.CIN IS UNIQUE CREATE CONSTRAINT ON (mer:Merchant) ASSERT mer.MerchantDetailsLocation IS UNIQUE​ CALL apoc.es.query("http://localhost:9200",'index','doc','size=100&scrol

我使用scrollid从Elasticsearch加载数据

CREATE CONSTRAINT ON (cus:Customer) ASSERT cus.CIN IS UNIQUE
CREATE CONSTRAINT ON (mer:Merchant) ASSERT mer.MerchantDetailsLocation IS UNIQUE​

CALL apoc.es.query("http://localhost:9200",'index','doc','size=100&scroll=5m',null) yield value with value._scroll_id as scrollId, value.hits.hits as hits​
UNWIND hits as hit​
UNWIND hit._source AS trans​
MERGE (C1:Customer {CIN: trans.CIN})​
MERGE (M1:Merchant {MerchantName: dctrans.MerchantDetailsLocation})​
MERGE (C1)-[:Transfered {CardNo: trans.CardNo, TxnAmount: trans.TxnAmount, UniqueId: trans.UniqueId} ]->(M1)​
​
WITH range(101,10000,100) as list, scrollId​
UNWIND list as count​
CALL apoc.es.get("http://localhost:9200","_search","scroll",null,{scroll:"5m",scroll_id:scrollId},null) yield value with value._scoll_id as scrollId, value.hits.hits as nextHits​
UNWIND nextHits as hit​
UNWIND hit._source AS trans​
MERGE (C1:Customer {CIN: trans.CIN})​
MERGE (M1:Merchant {MerchantName: dctrans.MerchantDetailsLocation})​
MERGE (C1)-[:Transfered {CardNo: trans.CardNo, TxnAmount: trans.TxnAmount, UniqueId: trans.UniqueId} ]->(M1)​
​return C1, M1​
我对两个节点设置了约束,客户和商户,客户作为关系进行了转移

在Elastic我有100万的数据

最初,我一次使用上面的代码加载100加载10000,然后如果我再次运行相同的代码来获取另一个10000,它会再次复制前10000的关系并转到下一个10000

所以我有两个问题

  • 为了避免关系重复,我可以知道如何根据其属性为关系设置约束吗?我有UniqueId唯一的属性
  • 我尝试在()-[r:Transfered]()上创建约束,断言r.UniqueId是唯一的;但不起作用

  • 如果可能的话,我可以知道如何保存滚动id以供以后使用,这样我就可以运行第二个段来获取第二个10000数据吗
  • 提前谢谢