Measure, judge and improve your Elasticsearch search
judy scores your search against queries that people have rated. It asks an LLM to rate the results nobody has rated. It tests every change before you ship it, and it tells you if the change is real.
Pre-release: not on NuGet yet. Build it from source for now.
ndcg@10: lexical -> hybrid over 479 paired queries mean 0.594 -> 0.661 (+0.067) 244 better, 146 same, 89 worse p = 0.0001 in plain words hybrid is better than lexical, and the difference is unlikely to be chance (p = 0.0001). On average ndcg@10 goes up by 0.067 (11% more than the baseline's 0.594). A better average can hide queries that got worse, and here 19% did. Read 'most regressed' before you ship.
557 documents need a label, which takes up to 179 calls to .anthropic-claude-4.5-haiku-chat_completion. Nothing was sent. (--dry-run) labelled 178 of 557 documents; wrote wands.llm.yaml ndcg@10 0.666 (human labels only: 0.661) judged@10 0.923 (human labels only: 0.886)
including the index mapping and settings (545 characters) Query 135: "low profile loveseat recliner" Partial term matching dominates: the multi_match query matches "low profile" alone, so beds outrank loveseats. Semantic field unused: the index has product_semantic (semantic_text), but the request does not query it.
ndcg@10 on lexical: 0.594; holdout 144 queries variant train holdout verdict min-should-match-75 -0.006 -0.049 (p=0.03) no gain phrase-boost-product-name +0.003 +0.004 (p=0.11) better on both semantic-hybrid-product-semantic +0.033 +0.037 (p=0.00) better on both Nothing was changed in your configuration.
ndcg@10 over 479 queries lexical 0.595 semantic 0.641 hybrid 0.666 oracle (best per query) 0.733 router 0.631 in plain words Your router scores 0.631, 0.036 below always using hybrid: on this data routing does not pay off.
How it works
Three steps. You need a list of queries, and a way to tell good results from bad ones.
Write down what good looks like
A judgement set lists queries and the results that answer them. A person gives each result a grade from 0 (wrong) to 3 (perfect).
- q: yellow fruit
ratings: {/banana: 3, /lemon: 2, /apple: 0}
Run the queries on your search
judy sends every query to your index and scores the ranked results against the grades. It names the queries that found nothing.
judy run my.judgements.yaml --target current
Compare two versions
judy scores both versions on the same queries. It says better, worse or no real difference, and it lists the queries that got worse.
judy compare current candidate --set my.judgements.yaml
New to the terms? The glossary explains each one, and the metrics page shows what each score means.
You do not have to rate every result yourself
A person must rate each result before it counts. A big index returns far more results than anyone can rate. An unrated result counts as wrong, so a better search gets punished for finding results nobody rated.
The LLM judge rates those results for you, and it shows how much its grades moved your score.
- Three providers. The Elastic Inference Service, Anthropic, or any OpenAI-compatible endpoint.
- The judge never sees your search request. It sees the query and the document. It cannot grade its own homework.
- You set the cost.
--dry-runcounts the calls.--max-callscaps them. - A human grade always wins. You can review each LLM grade and approve it.
before the judge ndcg@10 0.661 judged@10 0.886 (11% of the top ten: no rating) after 178 LLM grades ndcg@10 0.666 (human grades only: 0.661) judged@10 0.923 (human grades only: 0.886)
Let an agent improve your search
Judge, diagnose and suggest make one loop. The model rates the results, explains the failures and proposes changes. judy decides. It tests every proposal on queries the model never saw, and it answers with a number and an exit code.
- The model proposes. judy decides. The proposals vary from run to run. The measurement is the same every time.
- Every step is a command. Each has an exit code, and most have
--format jsonand--dry-run. A script or an agent can run the loop. - Your configuration stays as it is. A proposal is a file. You adopt it after the test says yes.
judy suggest run. The change that sounded sensible lost on new queries. The change that used the unused semantic_text field won.Works with how you search
judy sends your own requests to Elasticsearch, so it measures the search you run.
Put {{query}} in a request body. judy fills it in for every query.
judy runs your query-building code once per query. It works in any language, and a shell script can try it.
judy tells you how each query was answered. It shows if choosing a mode per query beats one mode for all.
Set a minimum score. A run below it exits with code 1, and judy writes a summary for the pull request.
judy also scores any search API over HTTP, and the run files that other tools write (TREC format).
Start in a few minutes
One command downloads an example dataset (WANDS, 480 rated queries), creates an index and loads it. Then you can run every command on this page.
judy import wands --url env:ES_URL --api-key env:ES_API_KEY
wands.judgements.yaml: 480 queries, 231873 judgements
loading 42994 products into judy-wands …
judy-wands: 42994 products