Regexp query

Regexp query #

Returns documents that contain terms matching a regular expression.

A regular expression is a way to match patterns in data using placeholder characters, called operators. For a list of operators supported by the regexp query, see Regular expression syntax.

Examples #

The following search returns documents where the org.id field contains any term that begins with in and ends with y. The .* operators match any characters of any length, including no characters. Matching terms can include ini, inni, and infini.

GET /_search
{
  "query": {
    "regexp": {
      "org.id": {
        "value": "in.*i",
        "case_insensitive": true
      }
    }
  }
}

Top-level parameters for range #

  • <field>
    (Required, object) Field you wish to search.

Parameters for <field> #

  • value
    (Required, string) Regular expression for terms you wish to find in the provided <field>. For a list of supported operators, see Regular expression syntax.
  • case_insensitive
    (Optional, Boolean) Allows ASCII case insensitive matching of the value with the indexed field values when set to true. Default is false.
Calendar August 28, 2024
Edit Edit this page