{"issue":{"state":"open","created_at":"2011-12-07T07:37:59Z","updated_at":"2011-12-07T07:57:48Z","user":{"gravatar_id":"21c5aeda0e3c59037354ab55992e80c5","id":804467,"url":"https://api.github.com/users/espeed","login":"espeed","avatar_url":"https://secure.gravatar.com/avatar/21c5aeda0e3c59037354ab55992e80c5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":2,"body":"I used the Gremlin extension to create an automatic index via a Gremlin script like this: https://gist.github.com/1440683\r\n\r\nHowever, the index does not show up in the list of indices...\r\n\r\n```\r\n$ curl -H Accept:application/json http://localhost:7474/db/data/index/node\r\n{\r\n  \"testidx2\" : {\r\n    \"template\" : \"http://localhost:7474/db/data/index/node/testidx2/{key}/{value}\",\r\n    \"_blueprints:type\" : \"MANUAL\",\r\n    \"provider\" : \"lucene\",\r\n    \"type\" : \"exact\"\r\n  },\r\n  \"testidx\" : {\r\n    \"template\" : \"http://localhost:7474/db/data/index/node/testidx/{key}/{value}\",\r\n    \"_blueprints:type\" : \"MANUAL\",\r\n    \"provider\" : \"lucene\",\r\n    \"type\" : \"exact\"\r\n  },\r\n  \"people\" : {\r\n    \"template\" : \"http://localhost:7474/db/data/index/node/people/{key}/{value}\",\r\n    \"_blueprints:type\" : \"MANUAL\",\r\n    \"provider\" : \"lucene\",\r\n    \"type\" : \"exact\"\r\n  }\r\n```\r\n\r\nBut when I try to create it again, I get an error saying it's already created:\r\n\r\n```bash\r\nPOST url:  http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script  \r\nPOST body: {\"script\":\"import groovy.json.JsonSlurper\\ndef slurper = new JsonSlurper()\\nkeys = null\\nif (keys != null) \\n  keys = slurper.parseText(keys)  \\npublic abstract class TestVertex implements Vertex {}  \\nindex = g.createAutomaticIndex('test_automatic_idxV',TestVertex.class,keys)   \\n\"} \r\n\r\n({'status': '200', 'content-length': '101', 'content-encoding': 'UTF-8', 'server': 'Jetty(6.1.25)', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '\"javax.script.ScriptException: java.lang.RuntimeException: Index already exists: test_automatic_idxV\"')\r\n```\r\n\r\nAlso, the return status is 200 even though the ScriptExtension is returning a Java RuntimeException:\r\n\r\n```\r\n\"javax.script.ScriptException: java.lang.RuntimeException: Index already exists: test_automatic_idxV\r\n```\r\n\r\nAnd the return value is not JSON. I have noticed several occurrences of the Gremlin extension not returning JSON and so you have to hack around it. It would be cleaner if all responses were JSON, including \"null\" and error responses.\r\n","assignee":null,"id":2472058,"number":119,"labels":[{"name":"bug","color":"e10c02","url":"https://api.github.com/repos/neo4j/community/labels/bug"},{"name":"server","color":"ededed","url":"https://api.github.com/repos/neo4j/community/labels/server"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Multiple Autoindex Issues","html_url":"https://github.com/neo4j/community/issues/119","closed_at":null,"url":"https://api.github.com/repos/neo4j/community/issues/119","milestone":null},"action":"created","comment":{"created_at":"2011-12-07T07:57:48Z","updated_at":"2011-12-07T07:57:48Z","user":{"gravatar_id":"21c5aeda0e3c59037354ab55992e80c5","id":804467,"url":"https://api.github.com/users/espeed","login":"espeed","avatar_url":"https://secure.gravatar.com/avatar/21c5aeda0e3c59037354ab55992e80c5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"Thanks Peter. One thing of note (I've been meaning to ask you this) -- notice the Gremlin script creates the automatic index via a Blueprints method:\r\n\r\n```groovy\r\n g.createAutomaticIndex('people',People.class,keys) \r\n```\r\n\r\nThis worked somewhat (neo4j is giving an error saying it's already created). To what extent can you use Blueprints methods via the Gremlin extension? \r\n\r\nThe Neo4j docs say that auto indexes are experimental, so I don't know if this is a bug or if it's a Blueprints thing.\r\n\r\n\r\n","id":3044350,"url":"https://api.github.com/repos/neo4j/community/issues/comments/3044350"}}