Open fppt opened 8 years ago
@fppt your query should be
g.V().has("TYPE", textContains('person')).order().by("DEGREE",incr).limit(80);
if you want to use your query,your schema should be:
management.buildIndex("byTypeDegree", Vertex.class)
.addKey(typeKey, Mapping.STRING.asParameter())
.addKey(degreeKey, Mapping.STRING.asParameter())
.buildMixedIndex("search");
because when you define your index ,do not special the Mapping ,so titan use the the default Mapping.DEFAULT
.
where titan execute a query ,titan will check the query keys is support by Titan Index. see the code in ElasticSearchIndex
line 967
if (AttributeUtil.isString(dataType)) {
switch(mapping) {
case DEFAULT:
case TEXT:
return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX || titanPredicate == Text.CONTAINS_REGEX;
case STRING:
return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.REGEX || titanPredicate==Text.PREFIX;
case TEXTSTRING:
return (titanPredicate instanceof Text) || titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL;
}
see more about index http://s3.thinkaurelius.com/docs/titan/1.0.0/index-parameters.html#text-search
When using Titan
1.0.0
and Elasticsearch as my indexing backend I create the following Mixed index:The goal is so that I can search for vertices of a specific type and order them using the degree. I believe the following should achieve that:
However the above traversal is clearly not using the Index as I get the following error:
What's odd is that I have confirmed that elastic search can answer my query very quickly. Using the following query directly to Elasticsearch:
I get the results I need:
So why can't Titan execute the traversal using the index ? Am I incorrectly creating the index or is the traversal incorrect ?