Skip to main content
Applies to:
  • Plan -
  • Deployment -

Summary

Issue: Filtering logs with chained OR 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 the IN operator for filtering metadata fields.

Step 2: Verify query performance

The IN 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 the IN operator doesn’t meet your requirements.