Return items_ids rather than note_ids as the rest of the API uses
items_ids to reference notes not note_ids. Also allow querying for only
a single field if needed.
This will allow rebuild of database as the backup documents will refer
to resource hashes not ids (its very difficult to restore resources with
ids unchanged). Also this allows docs to be migrated between databases
easily.