GRAYLOG - Chapter 7, Exercise 1 Solution ========================================================== Correctly Parenthesizing a Mixed AND/OR Query PROBLEM ------- A query needs to match either service scout or service search, but only at critical or error level (2 or 3). Using this chapter's own real parenthesization rule, write it correctly. SOLUTION -------- This chapter established that mixing AND and OR without explicit grouping is genuinely ambiguous, and that Lucene's own documentation recommends always parenthesizing each logical group separately. Two real groups are needed here: 1. Either service - grouped with OR: (service:scout OR service:search) 2. Level restricted to critical/error - grouped with OR: level:(2 OR 3), per Chapter 3's own syntax Combining both groups with AND: (service:scout OR service:search) AND level:(2 OR 3) ANSWER: (service:scout OR service:search) AND level:(2 OR 3) ---- WHY THIS WORKS AS AN ANSWER This directly applies the chapter's own real worked example - (jakarta OR apache) AND website - substituting this course's own real field values in the same structural shape. Without the outer parentheses around the two service values, the query's own real meaning would become genuinely ambiguous, exactly the trap this chapter's own warn-box described.