database design - Single MixedIndex with multiple properties OR multiple MixedIndexes with single property each? -


i using titan 1.0.0 cassandra storage backend , elasticsearch indexing backend, want model complex graph multiple vertices , edges. i've following considerations make:

  1. should chose have multiple mixedindexes single property each or single mixedindex multiple properties?

    mgmt.buildindex('nameandage',vertex.class).addkey(name,mapping.text.getparameter()).addkey(age,mapping.text.getparameter()).buildmixedindex("search") 

or

mgmt.buildindex('namemixed',vertex.class).addkey(name,mapping.text.getparameter()).buildmixedindex("search") mgmt.buildindex('agemixed',vertex.class).addkey(age,mapping.text.getparameter()).buildmixedindex("search") 

if i've chose singel mixed index multiple properties can span across properties on edges , vertices or there guideline?

  1. is better have properties shared across vertices / edges? meaning want have property "ondate" , have edges "registered", "marriedto", "agreedtoterms" , vertices "order", "travel".

shall there special considerations if property need have index?

have here @ documatation says

mixed indexes retrieve vertices or edges combination of added property keys.

and first question,

  • if aim @ using single index query any/all of properties @ one, use 1 mixed index. want have 1 single

example

string query="v.*:phani"; // searches property in index value includes `phani` iterable<titanindexquery.result<titanvertex>> result = titangraph.indexquery("name_mixed_index", query).vertices(); 

this searches properties of mixed index created. if added 10 properties added index, search 10 , on.

  • if aim @ querying 1 property use composite index. it's faster.

my recommendation, use single mixed index properties of interest query them @ once or query them combination like. if want single index, use composite index it.

for second question,

you can't share same property value across indexes , edges. have same name of property among of them. if intend query single property, aim composite indexes.

in short,

interested in making query includes multiple values or involve ordering? use mixed index multiple properties. # interested in making query on 1 property, use composite index.

more this, read documentation here indexing in titan 1.0.0.


Comments