The attached example ProfilerFilter.java demonstrates how to write and use a profiling filter that could log query execution times and warnings when fields that the query uses are not indexed.