I have a huge database that is around 1.5 million count of a single table and there are many tables. What I have to do is apply filter and sort stuffs. So, I modeled the graph database and still the sorting takes kinda 9 seconds because of eager aggregation, matching etc. So, what I want to do is store relevant objects into node properties for faster sorting. So, how can I achieve that.
match (b:Batch)-[:OBSERVATION_OF]->(obs)
with obs,b
match (obs)-[r:OF_CHAR_TYPE|:OF_INT_TYPE]-(obsType)
with distinct(obs.EZID) as EZID, {Observation:collect({TraitID:obs.TraitID, value:obsType.ObsValue})} as Observations
create (n:NEW{EZID:EZID,Observation:Observations}) //But this isn't allowed
I receive an error of "WARNING: Collections containing mixed types can not be stored in properties."
And, when I try this:
match (b:Batch)-[:OBSERVATION_OF]->(obs)
with obs,b
match (obs)-[r:OF_CHAR_TYPE|:OF_INT_TYPE]-(obsType)
with distinct(obs.EZID) as EZID, {Observation:collect({TraitID:obs.TraitID, value:obsType.ObsValue})} as Observations
create (n:NEW{EZID:EZID,TraitID:Observations.TraitID,Value:Observations.value})
I get an error "WARNING: Type mismatch: expected Any, Map, Node or Relationship but was Collection<Map>".
Please suggest me how to workaround this problem!