Add support for Match queries

Created on 24 September 2025, 12 days ago

Hi and thanks for offering this module to the community! We really appreciate.

Problem/Motivation

This module seems to send search queries as Query String queries which use the Lucene syntax (see codebase).

According to the Elastic documentation this type of query is not very forgiving ; instead it is recommended to use Match queries for search boxes:

Warning
Because it returns an error for any invalid syntax, we don’t recommend using the query_string query for search boxes.
If you don’t need to support a query syntax, consider using the match query. If you need the features of a query syntax, use the simple_query_string query, which is less strict.

We were able to confirm these limitations on our own installation: user-provided search queries do not always return results, for instance because the user provided a special character (hyphen) or because it includes a typical stopword ("of", "the", etc).

How about adding support for the recommended Match queries (or rather Multi-match queries), which expects a search query written by a human and is more appropriate for full-text search? According to the Elastic documentation:

The match query is the standard query for performing a full-text search, including options for fuzzy matching.

We have noticed that this module used to support Match queries in 2019 and 2022, but we were not able to find the reason why you switched to Query String queries. Why did you switch? Would you be open to adding back support to Match queries?

Proposed resolution

Attached is a proposed patch that adds support for Multi-match queries (when the parse mode is set to Direct). It can be tested by building a Search API View and setting the Parse mode of the fulltext field to Direct:

Feature request
Status

Needs review

Version

8.0

Component

Elasticsearch Connector Search API

Created by

🇨🇦Canada fengtan Montreal, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Merge request !108Issue #3548539: Add support for Match queries → (Merged) created by mparker17
  • Pipeline finished with Failed
    11 days ago
    Total: 515s
    #608830
  • Pipeline finished with Failed
    11 days ago
    Total: 531s
    #609150
  • Pipeline finished with Success
    11 days ago
    Total: 838s
    #609167
  • Pipeline finished with Success
    11 days ago
    Total: 848s
    #609272
  • Pipeline finished with Success
    11 days ago
    Total: 1015s
    #609285
Production build 0.71.5 2024