indexQuery error: Index with name [ ] is unknown or not configured properly


rajdee...@...
 

I am using indexQuery (see code below) and getting the following error:

[error] (run-main-0) java.lang.IllegalArgumentException: Index with name [vertexByText] is unknown or not configured properly
java.lang.IllegalArgumentException: Index with name [vertexByText] is unknown or not configured properly
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.janusgraph.graphdb.database.IndexSerializer.getMixedIndex(IndexSerializer.java:692)
at org.janusgraph.graphdb.database.IndexSerializer.executeQuery(IndexSerializer.java:617)
at org.janusgraph.graphdb.query.graph.IndexQueryBuilder.execute(IndexQueryBuilder.java:193)
at org.janusgraph.graphdb.query.graph.IndexQueryBuilder.vertices(IndexQueryBuilder.java:212)
at com.espn.idsvc.test.janusgraph.ExampleIndex$.apply(ExampleIndex.scala:87)
at com.espn.idsvc.test.janusgraph.ExampleIndex$.main(ExampleIndex.scala:108)
at com.espn.idsvc.test.janusgraph.ExampleIndex.main(ExampleIndex.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
[trace] Stack trace suppressed: run last test:run for the full output.



    val factory = JanusGraphFactory.build().set("storage.backend","cassandra").set("storage.hostname","localhost")


    factory
.open()


     val mgmt
= graph.openManagement();
       


      val property_key
= mgmt.getOrCreatePropertyKey(propertyKeyIdentifier)
     


      println
("** Started Indexing now **")


      mgmt
.buildIndex("vertexByText", classOf[Vertex]).addKey(property_key).buildCompositeIndex()
      mgmt
.commit()
      println
("** Finsihed Indexing **")
     
     
// try getting the index
      val retrievedIndex
= mgmt.getGraphIndex("vertexByText")


      graph
.addVertex(propertyKeyIdentifier, "Mass")

     


     
// This does not work for some reason
      val result
= graph.indexQuery(retrievedIndex.name(), "Mass").vertices().iterator()

What is causing it to fail even when the ,getGraphIndex  is able to retrieve the index?



HadoopMarc <m.c.d...@...>
 

Hi Rajdeep,

Just two suggestions:
  1. factory.open() takes some default graph that contains vertices?
  2. the mgmt object also has some(...) awaitStatus() method that must return the right value before the index can be used, see the examples in the ref docs

Cheers,     Marc

 

Op donderdag 6 april 2017 03:20:15 UTC+2 schreef raj...@...:

I am using indexQuery (see code below) and getting the following error:

[error] (run-main-0) java.lang.IllegalArgumentException: Index with name [vertexByText] is unknown or not configured properly
java.lang.IllegalArgumentException: Index with name [vertexByText] is unknown or not configured properly
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.janusgraph.graphdb.database.IndexSerializer.getMixedIndex(IndexSerializer.java:692)
at org.janusgraph.graphdb.database.IndexSerializer.executeQuery(IndexSerializer.java:617)
at org.janusgraph.graphdb.query.graph.IndexQueryBuilder.execute(IndexQueryBuilder.java:193)
at org.janusgraph.graphdb.query.graph.IndexQueryBuilder.vertices(IndexQueryBuilder.java:212)
at com.espn.idsvc.test.janusgraph.ExampleIndex$.apply(ExampleIndex.scala:87)
at com.espn.idsvc.test.janusgraph.ExampleIndex$.main(ExampleIndex.scala:108)
at com.espn.idsvc.test.janusgraph.ExampleIndex.main(ExampleIndex.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
[trace] Stack trace suppressed: run last test:run for the full output.



    val factory = JanusGraphFactory.build().set("storage.backend","cassandra").set("storage.hostname","localhost")


    factory
.open()


     val mgmt
= graph.openManagement();
       


      val property_key
= mgmt.getOrCreatePropertyKey(propertyKeyIdentifier)
     


      println
("** Started Indexing now **")


      mgmt
.buildIndex("vertexByText", classOf[Vertex]).addKey(property_key).buildCompositeIndex()
      mgmt
.commit()
      println
("** Finsihed Indexing **")
     
     
// try getting the index
      val retrievedIndex
= mgmt.getGraphIndex("vertexByText")


      graph
.addVertex(propertyKeyIdentifier, "Mass")

     


     
// This does not work for some reason
      val result
= graph.indexQuery(retrievedIndex.name(), "Mass").vertices().iterator()

What is causing it to fail even when the ,getGraphIndex  is able to retrieve the index?