The problem is that it's all leaky right now. to_index_query is concerned with the internal query sent to each vnode, mostly (range parameters). The other parameters are scattered (bucket, max results, return terms, etc). Ideally, we'd have this thin translation of HTTP/PB messages to this single '2i query' message to our internal API. That would check syntax at that layer, leaving the internal API to check semantics, fill in defaults, etc. So our internal API would cleanly be this single point of reference we want. Heck, we could even have a dumb transformer to avoid all this HTTP/PB code duplication... Might be worth opening an issue to looking into a through cleaning of this.