sorting and multi_query