On Jira Server, the search queries are executed in the same Java Virtual Machine (JVM) as Jira. On a cloud hosting, the JQL Search Extensions service is a separate deployment that communicates with Jira over the REST API. As a result, all operations in Jira Cloud are indexed asynchronously and any changes in Jira are reflected in the JQL with a slight delay.
Keep in mind that filters are indexed periodically. See Extended Search Filters to learn more about filter limitations.