0

I have Titan 0.3.2 running in embedded mode, and have been able to create and query ElasticSearch indexes via the Gremlin shell (see previous question). I am using the default configuration, which calls the ES index "search".

These searches return the correct nodes without error via the Gremlin shell:

g.query().has('my_label','abc').vertices()
g.query().has('my_label',CONTAINS,'abc').vertices()

However, if I attempt to run these same Gremlin queries via RexPro, Rexster sends back this error for the first query above:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
java.lang.IllegalArgumentException: Index is unknown or not configured: search

and this for the second:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
groovy.lang.MissingPropertyException: No such property: CONTAINS for class: Script3

Similarly, if I try to query on the indexed key via the REST API (GET):

http://localhost:8182/graphs/graph/vertices?key=my_key&value=abc

I receive the same error response:

{"message":"Index is unknown or not configured: search","error":"Index is unknown or not configured: search"}

Lastly, if I try to start with a clean database and run the index creation script through rexpro:

g.makeType().name("my_label").dataType(String.class).indexed("search", Vertex.class).unique(Direction.OUT).makePropertyKey();

I see the same unknown index error:

java.util.concurrent.ExecutionException: 
javax.script.ScriptException: 
javax.script.ScriptException: 
java.lang.IllegalArgumentException: Index is unknown or not configured: search

So it seems that Rexster needs some additional information about the indexing backend, possibly in its configuration file (I am using the default one included with the installation). Anyone familiar with this issue? Happy to provide more information.

Community
  • 1
  • 1
bcm360
  • 1,437
  • 2
  • 17
  • 25

1 Answers1

2

You might have a mix of things going on, but the main thing is that as of Titan 0.3.2, Rexster does not automatically import Titan classes, so you can't query with CONTAINS. You need to specify the full package name when doing so:

com.thinkaurelius.titan.core.attribute.Text.CONTAINS

I can't say for sure what else is wrong, but it looks like the elastic search index is not configured properly. That doesn't have much to do with the Rexster configuration file for Titan Server. It has more to do with the second argument you pass to titan.sh which contains Titan configuration information. Make sure that elastic search is properly configured as it is in this file shown here (default with the installation): https://github.com/thinkaurelius/titan/blob/master/config/titan-server-cassandra-es.properties

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • Stephen, thanks again for your help. I'm hoping that some of these questions will be helpful to future Titan users. The fully-qualified `CONTAINS` worked as you described. However, my Titan config file exactly matches the file you linked to, and ES works correctly when I query Titan via the Gremlin shell. If the issue isn't specific to Rexster, why do I see `Index is unknown or not configured: search` when querying via RexPro but not via the Gremlin shell? – bcm360 Aug 30 '13 at 12:58
  • I just meant that the problem isn't related to the rexster.xml you are feeding to titan.sh. It is likely related to the creation of your index or `titan-server-cassandra-es.properties` file. I was able to recreate that error by specifying `titan-server-cassandra.properties` as opposed to `titan-server-cassandra-es.properties` in my call to `titan.sh`. When elastic search is not configured, it seems you get that error if you try to use type maker against the graph. – stephen mallette Aug 30 '13 at 16:16
  • You're absolutely right that there was an issue with my batch script. It seems that Titan wasn't properly reading the configuration files I passed it, but the gremlin shell was able to figure out the elasticsearch index because of the `cassandra-es.local` config file (provided in `g = TitanFactory.open("cassandra-es.local")`). Thanks once again. – bcm360 Sep 24 '13 at 21:20