Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Regexp Query

More info about regexp query is in the official elasticsearch docs

The regexp query allows you to use regular expression term queries.

Simple example

{
    "filter": {
        "regexp":{
            "name.first" : "s.*y"
        }
    }
}

And now the query via DSL:

$regexpQuery = new RegexpQuery('name.first', 's.*y');

$search = new Search();
$search->addQuery($regexpQuery);

$queryArray = $search->toArray();