u can use this plugin nothingislost/obsidian-query-control (github.com) to format your query.
see this forum post for how to do so.