@Test
    public void shouldHaveFasterRuntimeWithLabelKeyValueIndex() throws Exception {
        final Neo4jGraph neo4j = (Neo4jGraph) this.graph;
        int maxVertices = 10000;
        for (int i = 0; i < maxVertices; i++) {
            if (i % 2 == 0)
                this.graph.addVertex(T.label, "something", "myId", i);
            else
                this.graph.addVertex(T.label, "nothing", "myId", i);
        }
        this.graph.tx().commit();

        // traversal
        final Runnable traversal = () -> {
            final Traversal<Vertex, Vertex> t = g.V().hasLabel("something").has("myId", 2000);
            final Vertex vertex = t.tryNext().get();
            assertFalse(t.hasNext());
            assertEquals(1, IteratorUtils.count(vertex.properties("myId")));
            assertEquals("something", vertex.label());
        };

        // no index
        this.graph.tx().readWrite();
        assertFalse(this.getBaseGraph().hasSchemaIndex("something", "myId"));
        TimeUtil.clock(20, traversal);
        final double noIndexTime = TimeUtil.clock(20, traversal);
        // index time
        neo4j.cypher("CREATE INDEX ON :something(myId)").iterate();
        this.graph.tx().commit();
        this.graph.tx().readWrite();
        Thread.sleep(5000); // wait for indices to be built
        assertTrue(this.getBaseGraph().hasSchemaIndex("something", "myId"));
        TimeUtil.clock(20, traversal);
        final double indexTime = TimeUtil.clock(20, traversal);
        logger.info("Query time (no-index vs. index): {}", noIndexTime + " vs. {}", indexTime);
        assertTrue((noIndexTime / 10) > indexTime); // should be at least 10x faster
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jIndexCheck.java