This is a cache of https://www.elastic.co/search-labs/blog/esql-introducing-scoring-semantic-search. It is a snapshot of the page at 2025-04-21T00:54:03.191+0000.
ES|QL, you know, for Search - Introducing scoring and semantic search - Elasticsearch Labs

ES|QL, you know, for Search - Introducing scoring and semantic search

With Elasticsearch 8.18 and 9.0, ES|QL comes with support for scoring, semantic search and more configuration options for the match function and a new KQL function.

Search with ES|QL

With Elasticsearch 8.18 and 9.0, ES|QL adds a host of new functionalities, including:

  • support for scoring
  • semantic search
  • more configuration options for the match function
  • a new KQL function

In this blog, we will review these 8.18 features and other exciting new features that we plan to add to ES|QL, reinforcing our investment in making ES|QL a modern search language ready to fit your needs, whether you are building a search application powered by ES|QL or analyzing your data in Kibana Discover.

Introducing scoring

In 8.17 we added the ability to filter documents using full text functions. If you are unfamiliar with full text filtering in ES|QL, we suggest reading our original blog post about it.

With 8.18 and 9.0 we introduce support for scoring, making it possible to return documents in order of their relevance. To access the score for each document, simply add the metadata _score field to your ES|QL query:

We retrieve the same scores we get from the equivalent search API query:

Full text search functions such as match, qstr and kql can only be used in the context of a WHERE condition and are the only ones that contribute to the score.

The _score column can not only be used to sort documents by relevance, but also in custom scoring formulas. In the next example, we keep only the most relevant results using a score threshold and then add a score boost based on the reader rating:

Improving the match function

In ES|QL, the match function simply translates to a Query DSL match query. In 8.18 and 9.0, we expanded the match function's capabilities to include all options that are currently available in Query DSL. It is now possible to set well-known match options such as boost, fuzziness and operator in ES|QL too:

The 8.18 release comes with the exciting announcement that semantic search is now generally available. We've expanded the match function to support querying over semantic_text field types.

In ES|QL, executing a semantic query is now as simple as performing a full-text query, as shown in this example:

In this example, we set semantic_title to use the semantic_text field type.

Mapping your index fields as semantic_text is all it takes to set up your index for semantic search.

Check our search with semantic text tutorial for more details.

Hybrid search with ES|QL

ES|QL makes it straightforward to do both semantic and lexical search at the same time. It is also possible to set different boosts, prioritizing results from semantic search or lexical search, depending on your use case:

Transitioning from KQL

If you are a long-term user of Kibana Discover and use KQL (Kibana Query Language) to query and visualize your data and you'd like to try ES|QL but don't know where to start, don't worry, we got you!

In 8.18 and 9.0, ES|QL adds a new function which allows you to use KQL inside ES|QL. This is as simple as:

ES|QL is already available in Kibana Discover.

This way, you get the best of both worlds: you can continue to use KQL and start getting more familiar with ES|QL at your own pace.

Check out our getting started with ES|QL guide for more information.

Beyond 8.18 and 9.0

In future releases, we'll be adding more and more search capabilities to ES|QL, including vector search, semantic reranking, enhanced score customization options, and additional methods for combining hybrid search results, such as Reciprocal Rank Fusion (RRF).

Try it out yourself

These changes are available starting with Elasticsearch 8.18, but they are already available in Elasticsearch Serverless. For Elasticsearch Serverless, start a free trial cloud today or try Elastic on your local machine now!

Follow the Search and filter in ES|QL tutorial for a hands-on introduction to the features described in this blog post! 

Elasticsearch is packed with new features to help you build the best search solutions for your use case. Dive into our sample notebooks to learn more, start a free cloud trial, or try Elastic on your local machine now.

Related content

Ready to build state of the art search experiences?

Sufficiently advanced search isn’t achieved with the efforts of one. Elasticsearch is powered by data scientists, ML ops, engineers, and many more who are just as passionate about search as your are. Let’s connect and work together to build the magical search experience that will get you the results you want.

Try it yourself