Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-24-2019 09:29 PM
Hi @michael.hunger
I have 2 indices in elastic data
Account, Payments
Account has AccountNo, AccBalance, CustomerNo
Payments has TrxID, Amount, AccountNo, CustomerNo, PartyNo
AccountNo and CustomerNo in both are foreign keys
First I created Indexes
CREATE INDEX ON :Account(AccountNo)
CREATE INDEX ON :PayTransactions(TrxID)
CREATE INDEX ON :Customer(CustomerNo)
Then I created vertex for all Accounts
CALL apoc.es.query('localhost:9200','account','doc','size=20',null) yield value with value.hits.hits as hits
UNWIND hits as hit
UNWIND hit._source AS account
MERGE (A1:Account {AccountNo: account.AccountNo, AccBalance: account.AvailableBalance})
MERGE (A2:Customer {CustomerNo: account.CustomerNo})
MERGE (A1)-[:CUST_NO]->(A2)
return A1,A2
Then I created vertex for Payments
CALL apoc.es.query('localhost:9200','payments','doc','size=20',null) yield value with value.hits.hits as hits
UNWIND hits as hit
UNWIND hit._source AS paytrans
MERGE (P1:PayTransactions {TrxID: paytrans.TrxID, TransAmount: paytrans.TransactionAmount})
MERGE (P2:Account {AccountNo: paytrans.AccountNo})
MERGE (P3:Customer {CustomerNo: paytrans.CustomerNo})
MERGE (P4:Customer {CustomerNo: paytrans.CounterpartyAccID})
MERGE (P1)-[:ACC_NO]->(P2)
MERGE (P1)-[:CUST_NO]->(P3)
MERGE (P1)-[:CPARTY]->(P4)
return P1, P2, P3, P4
How to get the CustomerNo to get shown in the purple vertex
May I have some help please
Thanks in Advance
11-25-2019 05:39 AM
What label do the purple nodes have? As long as those nodes have a CustomerNo
property you can have it visualised by clicking on the label button (the purple one in this case), and changing the caption.
See the screen shot below for an example of how to do it on a local dataset I have running:
11-25-2019 08:14 PM
Hi @mark.needham
Thanks for that, I got it
One more question please
Here I have loaded all the data in elastic, How should I insert the new data that's coming into elastic,
basically insert the new record one by one and the record should sit on the edges based on values as in the above sample?
As an example, I have loaded the data upto yesterday night 10PM which is say nearly 1million records, after that today I have received another 5000 records in elastic, I need to insert that one by one into my neo4j graph along with the corresponding edges?
Thanks
11-25-2019 09:14 PM
I found it,
Instead of creating Index like CREATE INDEX ON :Account(AccountNo)
I added CREATE CONSTRAINT ON (acc:Account) ASSERT acc.AccountNo IS UNIQUE
then ran the same apoc query, and it worked
Thanks
All the sessions of the conference are now available online