Applies to:
Summary
Issue: Filtering logs with chainedOR operations like metadata.user_id MATCH 'id1' OR metadata.user_id MATCH 'id2' fails when exceeding 128 conditions due to a backend JSON nesting recursion limit.
Cause: Chained OR queries are nested in JSON on the backend and hit the 128 query recursion limit.
Resolution: Use the IN operator instead of chained OR operations to filter by large sets of user IDs.
Resolution Steps
Use the IN operator for large ID sets
Step 1: Replace chained OR queries with IN operator
Use square brackets and theIN operator syntax for filtering metadata fields.
Step 2: Verify query performance
TheIN operator supports 300+ IDs and avoids the recursion limit entirely.
Alternative: Use the API for programmatic filtering
Step 1: Query logs via Braintrust API
Use the Braintrust API to fetch and filter logs programmatically if theIN operator doesn’t meet your requirements.