Locality-sensitive hashing is one reasonable approach for this. I suggest reading standard resources on locality-sensitive hashing (LSH). In your case, a locality-sensitive hash is a hash function that maps $h:\mathbb{R}^n \to S$ where if $x,y \in \mathbb{R}^n$ are close enough, then we'll have $h(x)=h(y)$ with high probability.
To get started, tead https://en.wikipedia.org/wiki/Locality-sensitive_hashing and https://cstheory.stackexchange.com/q/10053/5038.
Do understand that LSH is fundamentally probabilistic: if $x,y$ are similar, they will have a high probability of being mapped to the same bucket, but this cannot be guaranteed.
Alternatively, you might be interested in metric space embeddings. An embedding $E:\mathbb{R}^n \to \mathbb{R}^d$ has the property that if $x,y$ are close (i.e., $\|x-y\|_2$ is not too large), then $E(x),E(y)$ will be close (i.e., $\|E(x)-E(y)\|_2$ will be not too large). This could then provide a solution to your scheme, if you are satisfied that similar inputs map to buckets that are "nearby" but not necessarily identical.
For more on metric space embeddings, you can start with http://cs.stackexchange.com/a/27923/755https://cs.stackexchange.com/a/27923/755, https://cstheory.stackexchange.com/a/6818/5038, https://cstheory.stackexchange.com/q/21487/5038, https://cstheory.stackexchange.com/questions/tagged/embeddings.