Domanda

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.

È stato utile?

Soluzione

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");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top