在cypher Neo4j中使用scrollid从elastic重新加载数据?
我使用scrollid从Elasticsearch加载数据在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
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
所以我有两个问题