Lexical search finds results by matching the words in a query against the words in your indexed content. It’s the default search mode in OpenSearch, and for many use cases, it’s exactly what you need.
When someone types a product ID, a brand name, or a specific identifier into a search bar, they know what they’re looking for. They don’t want related concepts; they want that exact thing.
That’s the strength of lexical search: Precision.
The engine tokenizes your query into individual terms, looks for those terms in your index, and returns ranked results based on how well the words match.
When Lexical Search is the Right Choice?
Lexical search performs best when your content is specific and your users know what they are after. Examples include:
- Names and Entities: People, Organizations, Brands, Citations, and other precisely named terms.
- Parts catalogs: Automative or hardware parts with IDs and short names
- Log search: searching through application or system logs for specific error strings or event codes
- Product lookups: SKUs, model numbers, or other identifiers where an exact match is what’s needed
- Short, structured text: any field where the meaningful content is a word or short phrase, not a description.
Lexical Search is Fast and Efficient
The way OpenSearch keeps text fields for lexical search is optimized for fast retrieval and can even compress the documents to reduce storage. What it lacks in language understanding, it makes up in efficiency.
Where Lexical Search Has Limits
Lexical search doesn’t understand meaning. It matches words and ranks with custom tuning. If a user types “comfortable running shoes” hoping to find listings described as “high-cushion athletic footwear,” lexical search won’t connect those dots. For that kind of search, where intent matters more than exact phrasing, vector search picks up where lexical leaves off.
Lexical Search in OpenSearch
OpenSearch, at its core, is powered by a lexical search engine based on Lucene. Every Bonsai cluster supports lexical search out of the box. There is no additional configuration required. When you’re ready to add meaning-based search on top of that foundation, see Vector Search and Hybrid Search
Ready to take a closer look at Bonsai?
Bonsai manages your search clusters and helps you achieve better search results for your users and your business. Find out if Bonsai is a good fit for you in just 15 minutes.