Build an Elastic workflow that sends a data sample to a large model to propose classification labels. A human signs off, then a smaller model applies them across the full corpus. Split the expensive part of large language model (LLM) classification from the cheap part. This article builds an Elastic workflow where Claude Sonnet reads a stratified sample of NASA pilot incident reports and proposes classification labels based on what it finds. A human reviews the schema and signs off, and then Mistral Small 3. 1 applies the labels across the full corpus.

The routing is YAML, the results land in Elasticsearch as structured data, and the pattern works wherever you have free text that needs labeling. NASA Aviation Safety Reporting System (ASRS) reports describe unusual events during flights, such as missed altitudes, confusing clearances, runway issues, or mechanical problems. Each report already has an official category, like altitude deviation, course deviation, or ground encounter. In this article, we ask a different question: What does this report reveal about the pilot who wrote it?

The idea is to ask a model to infer a schema grounded on the data to classify the report based on criteria that help us figure out information about the report writers. Then ask a second model to apply the labels. You can find the full workflow definitions and helper scripts here . 4+ or Elastic Cloud Serverless. Elastic Workflows has been generally available (GA) since 9. A Kibana generative AI (GenAI) connector pointing at Claude Sonnet (or an equivalent reasoning model). We’ll use it to register an Elasticsearch inference endpoint. 10+ with elasticsearch>=9. Used by the dataset loader.

The workflow has two jobs: Decide what labels should exist, and then apply those labels to every report. The first job is open-ended. A large model reads a varied sample of reports and proposes a small schema of categorical fields. A field is one way to describe the writer, such as attribution_style or procedure_orientation . Each field has a few allowed values, such as self_critical , system_attributing , or balanced . The second job is repeatable. After a human approves the schema, a smaller model reads each report and chooses one value for each field.