A year of flights, as a graph.
OpenSearch's own sample data: the flights index any Dashboards installs with one click, preinstalled on the OpenSearch Playground. YANG-DB reads it as airports, flights and carriers, joined by departures, arrivals and routes: from a reshaped copy, or from the sample index as it is.
Run everything on your own engine.
The page talks to YANG-DB's REST API straight from your browser. Without an engine it shows results recorded from a real one, marked recorded, so you can explore first and run later.
Your engine
- The engine answers at
/health - The Flights ontology is registered
- The Airport index has data
The engine allows requests from any origin, so this works from yang-db.github.io to localhost. If your browser blocks it (Safari blocks http:// from an https:// page), open a local copy instead: docs/examples/flights/index.html in a clone of the repository.
Start it and load the data
- Start YANG-DB 0.12 or later and OpenSearch with Docker. The image is built from source (about 5 minutes the first time). Flights loads next to the Dragons tutorial in the same engine:
cd docker && ./buildDocker.sh Dragons docker compose -f docker-compose-os.yml up -d
- Load the flights. The loader registers the ontology, creates the indices, downloads the sample (13,059 flights) and reshapes it. From the repository root:
python3 examples/flights/load_flights.py --reset
Already clicked "Add sample data" in Dashboards?--from-index http://localhost:9200reads that index instead of downloading. - Register the mapping over the sample index. Clicked "Add sample data" in Dashboards? Then the index is there and nothing is loaded; otherwise the loader creates it the way Dashboards does (13,059 flights, unchanged). From the repository root:
python3 examples/flights/load_flights.py --in-place
- Connect on the left. All set: explore the schema.
More: examples/flights, and how an existing index is mapped: Event, Derived and Field.
One flight document becomes a small graph.
The sample has one flat document per flight, with both airports and the carrier written inline. YANG-DB reads it in either of two layouts, with the same ontology, the same queries and the same rows. Hover a field to see where it lands.
Reshaped copy. The loader splits each document into entities and relationships in YANG-DB's own layout: one index per type, each relationship stored from both ends. It is also the only layout with Route, computed from all the flights between two airports.
The index as it is. Nothing is copied: a mapping (FlightEvents) says which fields make which part of the graph, and the engine reads the sample index Dashboards created. The e2e suite checks that every query here returns the same rows as on the reshaped copy. Route, an aggregate, has no equivalent.
The ontology the queries are written against.
Three entity types and four relationship types (Flights.json). Route isn't in the sample: the loader derives it, one per origin and destination pair.Three entity types and three relationship types (FlightEvents.json, the names of Flights.json without Route, which the reshaping loader computes), mapped onto the sample index by FlightEvents-indexProvider.json. Click a type to see its properties and its stored documents; drag the nodes to rearrange them.
Where the graph lives in OpenSearch.
Flights has no index provider of its own, so the engine generates the simplest one: one index per type, named after it. Every relationship is stored twice, once from each end: the 13,059 departures are 26,118 documents.
Every type reads one index, opensearch_dashboards_sample_data_flights, which YANG-DB neither created nor changed. Flights are its documents; airports and carriers are values of its fields; each relationship is one field of a flight.
Ask the graph in Cypher.
Pick a query, edit it if you like, and run it. The result is drawn as a graph, listed as rows, or shown as the JSON the API returns. Each query's answer was checked against the sample data itself.
Save a query's results, then slice them.
With the projection cursor, the engine writes every result row into an OpenSearch index. Run an expensive query once, then summarise its rows, break them down by any field and page through them, without running it again. recorded