Problem with creating mixed indexes on existing data on 0.5.4

59 views
Skip to first unread message

Cosmin Ursachi

unread,
Oct 12, 2015, 6:58:33 PM10/12/15
to Aurelius
TitanManagement tm = titanGraph.getManagementSystem();

tm.buildIndex(Constants.INDEX_PREFIX + propertyName, Vertex.class).addKey(tm.makePropertyKey(propertyName).dataType(String.class).make()).buildMixedIndex("search");

Exception in thread "Thread-261" com.thinkaurelius.titan.core.SchemaViolationException: Adding this property for key [system%&%SchemaName] and value [rt%isp] violates a uniqueness constraint [SystemIndex#system%&%SchemaName]
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addPropertyInternal(StandardTitanTx.java:740)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.setProperty(StandardTitanTx.java:778)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:696)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makeSchemaVertex(StandardTitanTx.java:815)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makePropertyKey(StandardTitanTx.java:835)
at com.thinkaurelius.titan.graphdb.types.StandardPropertyKeyMaker.make(StandardPropertyKeyMaker.java:78)
at com.xPatterns.spaTitan.runners.IndexCreator.run(IndexCreator.java:73)
at java.lang.Thread.run(Thread.java:745)

// Error that basically says that the key needs to be unique. Meaning that TitanManagement allready has a key created for the propertyName

tm.buildIndex(Constants.INDEX_PREFIX + propertyName, Vertex.class).addKey(tm.getPropertyKey(propertyName)).buildMixedIndex("search");

// AND

tm.buildIndex(Constants.INDEX_PREFIX + propertyName, Vertex.class).addKey(tm.getPropertyKey(propertyName),
                        com.thinkaurelius.titan.core.schema.Parameter.of("maping",Mapping.STRING)).buildMixedIndex("search");

Caused by: org.elasticsearch.index.mapper.MapperParsingException: No type specified for property [cwlh]
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:282)
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214)
at org.elasticsearch.index.mapper.object.RootObjectMapper$TypeParser.parse(RootObjectMapper.java:136)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:211)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:192)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:434)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$4.execute(MetaDataMappingService.java:505)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:365)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:188)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:158)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

// Basically data is stored as Object and elasticsearch has problems identifying a type. That is what I understood.
//===========================================================================================


tm.buildIndex(Constants.INDEX_PREFIX + propertyName, Vertex.class).addKey(tm.getOrCreatePropertyKey(propertyName),
                        Mapping.STRING.getParameter()).buildMixedIndex("search");

Exception in thread "Thread-235" java.lang.IllegalArgumentException: Specified illegal mapping [STRING] for data type [class java.lang.Object]
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.register(ElasticSearchIndex.java:362)
at com.thinkaurelius.titan.diskstorage.indexing.IndexTransaction.register(IndexTransaction.java:83)
at com.thinkaurelius.titan.graphdb.database.IndexSerializer.register(IndexSerializer.java:92)
at com.thinkaurelius.titan.graphdb.database.management.ManagementSystem.addIndexKey(ManagementSystem.java:534)
at com.thinkaurelius.titan.graphdb.database.management.ManagementSystem$IndexBuilder.buildMixedIndex(ManagementSystem.java:647)
at com.xPatterns.spaTitan.runners.IndexCreator.run(IndexCreator.java:74)
at java.lang.Thread.run(Thread.java:745)


// If I specified a type it now says that it can't basically cast current Object type to String
//============================================================================================

Am I missing something?
Is there any way to create a mixed index over data/fields in Titan 0.5.4?
If no is there a way to index existing data in Titan 1.0

Kind regards,
Cosmin U.



Jason Plurad

unread,
Oct 13, 2015, 12:30:41 PM10/13/15
to Aurelius
The first error indicates that the property was previously created. Everything downstream from that is related to this root cause.

Exception in thread "Thread-261" com.thinkaurelius.titan.core.

SchemaViolationException: Adding this property for key [system%&%SchemaName] and value [rt%isp] violates a uniqueness constraint [SystemIndex#system%&%SchemaName]

Your graph probably had automatic schema enabled and then you used the property, so a default property was created for you with datatype Object.class and Cardinality.SINGLE. You can read more about this behavior here:
http://s3.thinkaurelius.com/docs/titan/1.0.0/schema.html#_automatic_schema_maker

"It is strongly encouraged to explicitly define all schema elements and to disable automatic schema creation by setting schema.default=none in the Titan graph configuration."
Reply all
Reply to author
Forward
0 new messages