Allow options for the `terms` query

Closes: #643