Efficient $k$-NN Search in IoT Data: Overlap Optimization in Tree-Based Indexing Structures