Reputation:
I'm using cloudant API for CouchDB in JAVA. I've created a partitioned database from Java but now i don't know how to create a partition and insert my json in this one.
final String dbName = "cinema";
CloudantClient client = ClientBuilder.url(new URL(url)).username(username).password(passw).build();
System.out.println("Server version: " + client.serverVersion());
Database db = CreatePartitioned.createPartitionedIfNotExists(client, dbName);
db.createIndex("movies"); //doesn't work
I have this error:
Exception in thread "main" com.cloudant.client.org.lightcouch.CouchDbException: 400 Bad Request at http://127.0.0.1:5984/movielens/_index. Error: bad_request. Reason: invalid UTF-8 JSON.
at com.cloudant.client.org.lightcouch.CouchDbClient.execute(CouchDbClient.java:597)
at com.cloudant.client.org.lightcouch.CouchDbClient.executeToInputStream(CouchDbClient.java:648)
at com.cloudant.client.api.Database.createIndex(Database.java:391)
at provaCouch.Prova_CouchDB.main(Prova_CouchDB.java:20)
I have to create 3 partition and on the net there are poor information. Does anybody know how to fix this problem?
Upvotes: 1
Views: 624