Skip to content

Add undocumented as=_explain to inspect the filtered query#356

Merged
mbklein merged 1 commit intodeploy/stagingfrom
as-explain
Apr 8, 2026
Merged

Add undocumented as=_explain to inspect the filtered query#356
mbklein merged 1 commit intodeploy/stagingfrom
as-explain

Conversation

@mbklein
Copy link
Copy Markdown
Contributor

@mbklein mbklein commented Apr 8, 2026

Adds _explain as a valid response format to return the query with auth filters added instead of executing the query and returning results.

Example:

POST /search/works?as=_explain
Content-Type: application/json

{
  "query": {
    "neural": {
      "embedding": {
        "query_text": "baseball negatives",
        "k": 10
      }
    }
  }
}
{
  "models": "mbk-dev-dc-v2-work",
  "body": {
    "from": 0,
    "query": {
      "neural": {
        "embedding": {
          "filter": {
            "bool": {
              "filter": [
                {
                  "terms": {
                    "published": [
                      true
                    ]
                  }
                },
                {
                  "terms": {
                    "visibility": [
                      "Institution",
                      "Public"
                    ]
                  }
                }
              ]
            }
          },
          "k": 10,
          "model_id": "TJqjgZUBz6P6wl85sCAv",
          "query_text": "baseball negatives"
        }
      }
    },
    "size": 10,
    "track_total_hits": true
  }
}

@mbklein mbklein merged commit fbc959a into deploy/staging Apr 8, 2026
2 checks passed
@mbklein mbklein deleted the as-explain branch April 8, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants