I tried to use curl to create index but failed:
curl -H Accept:application/json -H Content-Type:applicatin/json -X
POST -d '{"name":"test"}'
http://localhost:7474/db/data/index/node
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /db/data/index/node. Reason:
<pre> Unsupported Media Type</pre></p><hr /><i><small>Powered by
Jetty://</small></i><br/>
<br/>
<br/>
<br/>
also I tried to create index using java rest client. it return 500
error. and I found the server's log:
2012-5-30 17:42:43 org.mortbay.log.Slf4jLog warn
Severe: /db/data/index/node/
java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.String
at org.neo4j.index.impl.lucene.LuceneIndexImplementation.match(LuceneIndexImplementation.java:129)
at org.neo4j.index.impl.lucene.LuceneIndexImplementation.configMatches(LuceneIndexImplementation.java:120)
my java client codes:
public boolean addNodeIndex(String indexName){
final String nodeEntryPointUri = DistrictImportor.SERVER_ROOT_URI +
"index/node/";
//
http://localhost:7474/db/data/node
WebResource resource = Client.create()
.resource( nodeEntryPointUri );
// POST {} to the node entry point URI
String data="{\"name\":\""+indexName+"\",
\"config\":{\"type\":\"fulltext\"}}";
ClientResponse response = resource.accept( MediaType.APPLICATION_JSON )
.type( MediaType.APPLICATION_JSON )
.entity(data)
.post( ClientResponse.class );
if(response.getStatus()>=200 && response.getStatus()<300) return true;
return false;
}
my version of neo4j is 1.7