When hybrid search truly shines

Demonstrating when hybrid search is better than lexical or semantic search on their own.

Elasticsearch has native integrations with the industry-leading Gen AI tools and providers. Check out our webinars on going Beyond RAG Basics, or building prod-ready apps with the Elastic vector database.

To build the best search solutions for your use case, start a free cloud trial or try Elastic on your local machine now.

In this article, we are going to explore hybrid search by examples, and show when it truly shines against using lexical or semantic search techniques alone.

What is hybrid search?

Hybrid search is a technique that combines different search approaches such as traditional lexical term matching, and semantic search.

Lexical search is good when users know the exact words. This approach will find the relevant documents, and sort them in a way that makes sense by using TF-IDF which means: The more common across the dataset the term you are searching is, the less it contributes to the score; and the more common it is within a certain document the more it contributes to the score.

But, what if the words in the query are not present in the documents? Sometimes the user is not looking for something in concrete, but for a concept. They may not be looking for a specific restaurant, but for "a nice place to eat with family". For this kind of queries, semantic search is useful because it takes into consideration the context of the search query and brings similar documents. You can expect to get more related documents back than with the previous approach, but in return, this approach struggles with precision, especially with numbers.

Hybrid search gives us the best of both worlds by blending the precision of term-matching together with the context-aware matching of semantic search.

You can read a deep dive on hybrid search in this article, and more about lexical and semantic search differences in this one.

Let's create an example using real estate units.