Skip to main content

Query Builder: AND/OR Connectors

TL;DR

The system automatically uses AND when connecting filters on different fields. It automatically uses OR when connecting multiple filters on the same field. You can override either behavior by explicitly selecting a connector before adding your filter.

What You Need to Know

When you build queries to filter your logs, you're combining multiple conditions. The words AND and OR between these conditions determine what results you see. Our query builder treats these connectors as visible pieces you can see and control, not invisible background logic.

The Basic Idea

Think of building a query like giving instructions: "Show me logs where the user is admin AND the status is 500." The AND is just as important as the conditions themselves because it defines the relationship. Our system makes these relationships visible as tokens between your filters, so you always know exactly how your query works.

How It Works Automatically

Most of the time, you don't need to manually select AND or OR. The system makes smart choices based on what you're doing.

When you add filters for different fields, the system connects them with AND. This makes sense because you're typically adding more constraints to narrow your search. If you search for "status equals 500" and then add "user equals admin," you want logs that match both conditions.

When you add multiple filters for the same field, the system switches to OR instead. This is because you're usually looking for alternatives. If you filter for "body contains error" and then add "body contains timeout," you probably want logs that have either word, not logs that magically contain both phrases at once.

When You Want Manual Control

You can always override the automatic behavior by explicitly selecting AND or OR from the dropdown before adding your next filter. When you do this, the system respects your choice completely and uses exactly what you selected.

This is useful when the automatic logic doesn't match what you want. For example, if you're adding filters for different fields but want OR instead of the default AND, just select OR first and then add your filter.

What Happens When You Remove Filters

When you delete a filter, the system cleans up the connectors around it. If a connector ends up with nothing to connect (both its filters are gone), it disappears too. If you remove a filter from a group of same-field filters, the system may adjust the remaining connectors to keep the logic sensible.

This automatic cleanup keeps your query tidy without you having to manually fix connectors every time you make changes.

Why This Matters for You

The visible connector approach means you can always see exactly how your conditions combine. There's no guessing about whether you're searching for "this AND that" or "this OR that"—it's right there in the interface. You can build complex queries by adding filters one at a time and watching the logic build up visually.

If the logic doesn't look right, you can edit it. Remove filters, add explicit connectors, or reorder conditions. The interface shows you the logical structure as you build it, making it easier to create exactly the query you need.

Quick Reference

The system automatically uses AND when connecting filters on different fields. It automatically uses OR when connecting multiple filters on the same field. You can override either behavior by explicitly selecting a connector before adding your filter. When you remove filters, the system automatically cleans up orphaned or unnecessary connectors.

That's the essence of how logical connectors work in the query builder. The system tries to predict what you want while always giving you the power to specify exactly what you need.