Home / Companies / Vespa / Blog / Post Details
Content Deep Dive

Accelerating Map Search in Vespa: Fast-Search Map Fields

Blog post from Vespa

Post Details
Company
Date Published
Author
Jan Böker
Word Count
2,791
Company Posts That Month
2
Language
English
Hacker News Points
-
Post removed?
No
Summary

Vespa’s map data type offers flexible modeling for varied product attributes in large catalogs, but it is implemented internally as paired key and value arrays, requiring the sameElement() operator to verify that a key and value occur at the same array position. Although fast-search indexes can quickly identify documents matching an individual key or value, sameElement() can become slow when its first condition matches many documents because it must still perform per-document checks and array-index intersections. Vespa engineers improved this by encoding each map entry into a single searchable attribute, allowing direct lookups of combined key-value terms and eliminating the costly same-element matching step, producing benchmarked gains of more than 100 times in some cases. For numeric values and ranges, the approach uses order-preserving excess-N encodings stored as strings, supported by string-range queries introduced in Vespa 8.755.13. Starting with Vespa 8.773.18, users can declare fast-search map fields directly in schemas and query them through the restricted mapMatch() operator or simplified key lookup syntax, with support for several string and numeric key and value types as well as array-of-struct fields.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.