2
votes

Elasticsearch gives the ability to automatically create Indexes from json. Is this ability available when using Titan as a datastore and Elastic Search as an external index? From what I have seen, it seems as though Titan Indexes must be predefined.

1
Titan automatically creates the needed indexes: one for vertices, one for edges. Why do you want to create additional indexes?Matthias Broecheler
I want full text search on all the properties of documents and I want to create connections between the documents. Elasticsearch automatically indexes newly found properties so I was wondering if I could use it externally to fully index data without writing an indexing schema.GTDev

1 Answers

2
votes

Titan indexes must be defined before the respective property key is first used, however, they can be defined while the database is running and therefore must not be defined a priori.

In other words, you just need to define the index when the property is first seen so that Titan knows what to do with it. You don't have to predefine all of those up front.

For example:

TitanKey key = graph.getType("yourkey");
if (key==null) { //First time we have seen it, let's define it
    key = graph.makeKey("yourkey").dataType(String.class).indexed("search",Vertex.class).make()
}
v.setProperty(key,"yourvalue");