Elasticsearch: Find substring match

To search for partial field matches and exact matches, it will work better if you define the fields as “not analyzed” or as keywords (rather than text), then use a wildcard query.

See also this.

To use a wildcard query, append * on both ends of the string you are searching for:

POST /my_index/my_type/_search
{
"query": {
    "wildcard": {
       "name": {
          "value": "*en's*"
       }
    }
}
}

To use with case insensitivity, use a custom analyzer with a lowercase filter and keyword tokenizer.

Custom Analyzer:

"custom_analyzer": {
    "tokenizer": "keyword",
    "filter": ["lowercase"]
}

Make the search string lowercase

If you get search string as AsD: change it to *asd*

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)