rearrange tables in document
add documents and their ids and queries.