﻿---
title: File formats
description: judy reads and writes plain files, so they can be committed, diffed and kept as CI artifacts. {set} is the set's file name without .judgements.yaml: wands.judgements.yaml...
url: https://docs-v3-preview.elastic.dev/reference/formats
---

# File formats
judy reads and writes plain files, so they can be committed, diffed and kept as CI artifacts.

| File                                      | Written by                            | Holds                                                                                                        |
|-------------------------------------------|---------------------------------------|--------------------------------------------------------------------------------------------------------------|
| `*.judgements.yaml`                       | you, `judy import`, `judy synthesize` | queries and graded judgements. See [Judgement sets](https://docs-v3-preview.elastic.dev/concepts/judgements) |
| `{set}.{target}.results.yaml`             | `judy run`                            | each query's metrics and ranked ids                                                                          |
| `{set}.{target}.requests.jsonl`           | `judy run`                            | the request judy sent for each query                                                                         |
| `{set}.llm.yaml`                          | `judy judge`                          | LLM labels, kept apart from your set                                                                         |
| `{set}.{target}.diagnosis.md`             | `judy diagnose`                       | the advisor's answer                                                                                         |
| `{set}.{target}.{variant}.json` / `.esql` | `judy suggest`                        | a proposed template                                                                                          |
| `*.run`                                   | other systems, `judy export run`      | a TREC run                                                                                                   |

`{set}` is the set's file name without `.judgements.yaml`: `wands.judgements.yaml` gives `wands.lexical.results.yaml`.

## Results: `{set}.{target}.results.yaml`

```yaml
set: wands
target: lexical
k: 10
labels: human
queries: 480
scorable: 479
errors: 0
scorecard:
  success@1: 0.8205
  ndcg@10: 0.5939
  judged@10: 0.8645
  …
by_tag:
  "words:1":
    ndcg@10: 0.9005
    …
  "mode:lexical":
    ndcg@10: 0.5939
    …
results:
  - id: "0"
    q: salon chair
    request: "0d6519b2be78"    
    mode: lexical
    first: 1                   
    metrics:
      ndcg@10: 0.5455
      …
    hits:
      - "3 7465"                # the grade ("?" for unjudged) and the document id, in rank order
      - "1 9234"
      …
```

`judy compare` reads two of these, so it needs no cluster.

## Requests: `{set}.{target}.requests.jsonl`

One line per query, with the exact request judy sent:
```text
{"id":"0","hash":"0d6519b2be78","request":{"size":10,"_source":["product_id", …],"query":{"multi_match":{…}}}}
```

The `hash` is the same value as `request` in the results file. It is written when judy built the request (Query DSL, ES|QL and
builder targets).

## TREC

`judy` reads and writes the formats used by `trec_eval` and `ranx`.
A **run file** has one line per result: `topic Q0 document rank score tag`.
```text
q1 Q0 /banana 1 9 cand
q1 Q0 /lemon 2 8 cand
```

A `run` target reads one, matching `topic` to the set's query `id`. `judy export run` writes the run behind a results file. `judy export trec` writes a set's topics and qrels. You can then
check judy's numbers with `trec_eval`. `judy import trec` converts
topics and qrels into a judgement set.

## Exit codes


| Code | Meaning                                                                  |
|------|--------------------------------------------------------------------------|
| 0    | ok                                                                       |
| 1    | a gate was breached, or a comparison regressed beyond `--max-regression` |
| 2    | usage error or an invalid file                                           |
| 3    | an IO error or failed searches                                           |