Wildcard query

More info about Wildcard query is in the official elasticsearch docs

Matches documents that have fields matching a wildcard expression (not analyzed).

Lets take an example to write a wildcard query with Elasticsearch DSL.

{
    "wildcard" : {
        "user" : {
            "value" : "ki*y"
        },
        "boost" : 2.0
    }
}

And now the query via DSL:


$search = new Search();
$wildcard= new WildcardQuery('user', 'ki*y', ["boost" => 2.0]);
$search->addQuery($wildcard);
$queryArray = $search->toArray();