Esempio n. 1
0
  public static void main(String[] args) {
    CloudantClient client =
        new CloudantClient("http://username.cloudant.com", "username", "password");
    Database db = client.database("java-searchindex", false);

    Map<String, Object> animals = new HashMap<>();
    animals.put("index", "function(doc){ index(\"default\", doc._id); }");

    Map<String, Object> indexes = new HashMap<>();
    indexes.put("animals", animals);

    Map<String, Object> ddoc = new HashMap<>();
    ddoc.put("_id", "_design/searchindex");
    ddoc.put("indexes", indexes);

    db.save(ddoc);
  }