Pijuli I think you're confusing table access and Query field access. A query like this:
DB.search(User.user.username == 'Jhon')
searches for all elements that look like this:
{'user': {'username': 'Jhon'}}
You instead want to use the table object for searching:
from tinydb import TinyDB, Query
DB = TinyDB('dbtest.json')
table = DB.table('user')
table.insert({'id': 1, 'username': 'Jhon'})
User = Query()
print table.search(User.username == 'Jhon')
Does this work for you?
Cheers!