Search query to return docs based on conditions inside the doc