liveBook · Manning

Structured data

As explained in Elasticsearch in Action, Second Edition

Structured data is information organized according to a predefined schema or consistent fields and types.

Structured data is information arranged in a predefined schema: fields have expected names, shapes, and types. Dates, numbers, Booleans, and database records fit this model because each value must follow a known format before storage. That organization makes the data straightforward to search precisely. section 1.2.1

A structured search asks whether a document matches a condition, not how well it matches. Results are binary: a document is included or excluded, with no relevancy score and no close-match result. This suits requests such as finding canceled flights from the last month, weekly bestseller books, or a logged-in user’s activity. section 1.2.1

Choose exact matching for a production filter

A search for crimes in London during the last month depends on fields such as location and date. The goal is to return records inside the requested bounds, rather than rank documents by how similar their wording is to the request. A range query is one way to search structured values within bounds. section 9.10

Elasticsearch uses term-level search for structured fields, including:

  • Numbers, keywords, Booleans, and dates, where matching is based on stored values. section 9.10
  • A term query for one value or a terms query for multiple values in one field. section 9.10
  • Range queries for bounded values and prefix or wildcard queries for matching value patterns. section 9.10

Use structured queries on fields that are not analyzed at indexing time. Term-level queries are not analyzed; applying them to text fields that undergo text analysis can return incorrect results or no results. For text where relevance matters, use full-text search instead. section 8.9 section 9.10

Structured search is useful alongside full-text search rather than as a replacement for it. Traditional database searches commonly use exact value matching, while search engines add capabilities for large-scale text search, near-real-time indexing, fuzzy matching, stemming, and synonyms. Elasticsearch can also analyze and aggregate structured as well as unstructured data, but it does not replace every storage technology. section 1.2.3 section 1.4.5

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Defines schemas and binary matching, then names term-level query families without detailing their implementation.
Examples
Uses canceled flights, bestseller books, user activity, and London crime dates to illustrate exact and range matching.
What it assumes
Introduces structured data from zero through familiar database fields and everyday search examples.
What you can do after
Apply it via Elasticsearch term-level queries to filter numbers, keywords, Booleans, and dates exactly.
How it connects
Contrasts structured data with unstructured data, full-text search, relevancy scoring, text analysis, and term-level queries.

Also explained in

Compare how 24 books explain structured data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.