This example works on a clean database. Can you share what you are seeing? See also
janusgraph-0.1.1-hadoop2]$ ./bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data/janusgraph-0.1.1-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/janusgraph-0.1.1-hadoop2/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
06:53:32 WARN org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> // Example assumes this exists
==>true
gremlin> graph = JanusGraphFactory.open('inmemory')
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@56913163
gremlin> mgmt.makePropertyKey('name').dataType(String.class).make()
==>name
gremlin> mgmt.makePropertyKey('age').dataType(Integer.class).make()
==>age
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> // Start example
==>true
gremlin> graph.tx().rollback() //Never create new indexes while a transaction is active
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@5633ed82
gremlin> name = mgmt.getPropertyKey('name')
==>name
gremlin> age = mgmt.getPropertyKey('age')
==>age
gremlin> mgmt.buildIndex('byNameComposite', Vertex.class).addKey(name).buildCompositeIndex()
==>byNameComposite
gremlin> mgmt.buildIndex('byNameAndAgeComposite', Vertex.class).addKey(name).addKey(age).buildCompositeIndex()
==>byNameAndAgeComposite
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> //Wait for the index to become REGISTERED
==>true
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byNameComposite').call()
==>GraphIndexStatusReport[success=true, indexName='byNameComposite', targetStatus=REGISTERED, notConverged={}, converged={name=REGISTERED}, elapsed=PT7.529S]
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byNameAndAgeComposite').call()
==>GraphIndexStatusReport[success=true, indexName='byNameAndAgeComposite', targetStatus=REGISTERED, notConverged={}, converged={name=REGISTERED, age=REGISTERED}, elapsed=PT0.002S]
gremlin>
gremlin> //Reindex the existing data
==>true
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@3204e238
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byNameComposite"), SchemaAction.REINDEX).get()
==>org.janusgraph.diskstorage.keycolumnvalue.scan.StandardScanMetrics@181d8899
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byNameAndAgeComposite"), SchemaAction.REINDEX).get()
==>org.janusgraph.diskstorage.keycolumnvalue.scan.StandardScanMetrics@3d7fb838
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byNameComposite').status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=true, indexName='byNameComposite', targetStatus=ENABLED, notConverged={}, converged={name=ENABLED}, elapsed=PT0.002S]
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byNameAndAgeComposite').status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=true, indexName='byNameAndAgeComposite', targetStatus=ENABLED, notConverged={}, converged={name=ENABLED, age=ENABLED}, elapsed=PT0.001S]