Titan loading problems with elastic search
You should be more specific on your Titan dependencies so you don't pull in unintended artifacts. Instead of using titan-all
, try something like this:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'compile group: 'com.thinkaurelius.titan', name: 'titan-es', version: '1.0.0'
You should not need to include gremlin-core
explicitly because it is a dependency of titan-core
, however if you do add it, it should be aligned with the TinkerPop version that Titan 1.0 uses:
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.1-incubating'
Updated
Your previous failed attempts have likely created an invalid graph instance stored under DIRECTORY
. You must recursively remove DIRECTORY
before attempting to create a new graph using the same directory.
Elasticsearch indexing backend does not work with a index.search.DIRECTORY
configuration (note the case). This is the relevant part of the stack trace:
Ignored configuration entry for index.search.DIRECTORY since it does not map to an option java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
You can read more about the various Elasticsearch configuration options in Chapter 22 of the Titan documentation.
Instead of Elasticsearch, consider using Lucene. Its configuration looks similar to BerkeleyJE storage, and both are well-suited for a single-machine Titan.
TitanFactory.Builder config = TitanFactory.build();config.set("storage.backend", "berkeleyje");config.set("storage.directory", DIRECTORY + File.separator + "berkeleyje");config.set("index." + INDEX_NAME + ".backend", "lucene");config.set("index." + INDEX_NAME + ".directory", DIRECTORY + File.separator + "lucene");graph = config.open();
Also update build.gradle
with the dependency for lucene:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'compile group: 'com.thinkaurelius.titan', name: 'titan-lucene', version: '1.0.0'
I'd also recommend trying to build a Titan project without Neo4j, OrientDB, Sparksee, and other non-Titan dependencies first to ensure you have a simple project that works without any dependency conflicts.
You appear to have a classpath issue:
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6 at org.elasticsearch.Version.(Version.java:43)
Titan-es 1.0.0 depends on Elasticsearch 1.5.1 which again depends on Lucene 4.10.4 which has a deprecated field org.apache.lucene.util.Version.LUCENE_3_6
. This field was removed in later versions of Lucene. You need to check your classpath and make sure you are pulling in the correct version of Lucene.