Here is one of sample query.
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "a*",
"quote_analyzer": "standard",
"allow_leading_wildcard": "true",
"analyze_wildcard": "true",
"default_operator": "AND",
"phrase_slop": 1
}
},
{
"script": {
"script": {
"source": "Pattern p = /\\s?a\\S*?/i; p.matcher(params._source.summary ?: '').find();",
"lang": "painless"
}
}
}
]
}
}
}